Prompted by a discussion on irc.
While /home/_sysupgrade is a sensible default, it's not always possible
to use (for instance if /home is encrypted and mounted via rc.local or
even manually over ssh). Previous attempts have had sysupgrade(8)
automagically figure out a sensible location based on available space, but
this has issues too (a sufficiently large tmp on mfs), and breaks in the
case I mentioned. All this diff does is add an '-l path' argument to
sysupgrade allowing the user to specify where the sets get downloaded
to, with /home/_sysupgrade remaining the default if nothing is passed.
For example, if the only partition with sufficient space is /usr/local a
user might pass:
sysupgrade -l /usr/local/sets
Cheers,
Joe
Index: sysupgrade.8
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
retrieving revision 1.10
diff -u -p -r1.10 sysupgrade.8
--- sysupgrade.8 3 Oct 2019 12:43:58 -0000 1.10
+++ sysupgrade.8 15 Oct 2019 20:07:50 -0000
@@ -23,6 +23,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl fkn
+.Op Fl l Ar path
.Op Fl r | s
.Op Ar installurl
.Sh DESCRIPTION
@@ -53,9 +54,13 @@ Force an already applied upgrade.
The default is to upgrade to latest snapshot only if available.
This option has no effect on releases.
.It Fl k
-Keep the files in
-.Pa /home/_sysupgrade .
+Keep the sets.
By default they will be deleted after the upgrade.
+.It Fl l Ar path
+Specify the
+.Ar path
+the upgrade will be downloaded to.
+The default is /home/_sysupgrade.
.It Fl n
Fetch and verify the files and create
.Pa /bsd.upgrade
@@ -77,7 +82,7 @@ The ramdisk kernel to trigger an unatten
.Ox
mirror top-level URL for fetching an upgrade.
.It Pa /home/_sysupgrade
-Directory the upgrade is downloaded to.
+Default directory the upgrade is downloaded to.
.El
.Sh SEE ALSO
.Xr signify 1 ,
Index: sysupgrade.sh
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.26
diff -u -p -r1.26 sysupgrade.sh
--- sysupgrade.sh 14 Oct 2019 06:58:53 -0000 1.26
+++ sysupgrade.sh 15 Oct 2019 20:07:50 -0000
@@ -34,7 +34,7 @@ ug_err()
usage()
{
- ug_err "usage: ${0##*/} [-fkn] [-r | -s] [installurl]"
+ ug_err "usage: ${0##*/} [-fkn] [-l path] [-r | -s] [installurl]"
}
unpriv()
@@ -79,10 +79,11 @@ FORCE=false
KEEP=false
REBOOT=true
-while getopts fknrs arg; do
+while getopts fkl:nrs arg; do
case ${arg} in
f) FORCE=true;;
k) KEEP=true;;
+ l) SETSDIR=${OPTARG};;
n) REBOOT=false;;
r) RELEASE=true;;
s) SNAP=true;;
@@ -188,7 +189,7 @@ ${KEEP} && > keep
cat <<__EOT >/auto_upgrade.conf
Location of sets = disk
-Pathname to the sets = /home/_sysupgrade/
+Pathname to the sets = ${SETSDIR}
Set name(s) = done
Directory does not contain SHA256.sig. Continue without verification = yes
__EOT
@@ -196,7 +197,7 @@ __EOT
if ! ${KEEP}; then
CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g')
cat <<__EOT > /etc/rc.firsttime
-rm -f /home/_sysupgrade/{${CLEAN}}
+rm -f ${SETSDIR}/{${CLEAN}}
__EOT
fi