Hello,

Given the amount of people which encrypt /home directory on their servers, it might be useful to be able to define another directory for the sets in sysupgrade as /home_sysupgrade will not be available in that case.
Here is a patch for this.

Regards
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	6 Nov 2019 12:36:48 -0000
@@ -22,6 +22,7 @@
 .Nd upgrade system to the next release or a new snapshot
 .Sh SYNOPSIS
 .Nm
+.Op Fl d Ar directory
 .Op Fl fkn
 .Op Fl r | s
 .Op Ar installurl
@@ -48,6 +49,12 @@ triggering a one-shot upgrade using the 
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
+.It Fl d Ar directory
+Choose the 
+.Ar directory
+in which the sets will be downloaded.
+Default is
+.Pa /home/_sysupgrade .
 .It Fl f
 Force an already applied upgrade.
 The default is to upgrade to latest snapshot only if available.
Index: sysupgrade.sh
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.30
diff -u -p -r1.30 sysupgrade.sh
--- sysupgrade.sh	3 Nov 2019 18:22:45 -0000	1.30
+++ sysupgrade.sh	6 Nov 2019 12:36:48 -0000
@@ -25,7 +25,6 @@ umask 0022
 export PATH=/usr/bin:/bin:/usr/sbin:/sbin
 
 ARCH=$(uname -m)
-SETSDIR=/home/_sysupgrade
 
 ug_err()
 {
@@ -73,14 +72,16 @@ rmel() {
 	echo -n "$_c"
 }
 
+SETSDIR=/home/_sysupgrade
 RELEASE=false
 SNAP=false
 FORCE=false
 KEEP=false
 REBOOT=true
 
-while getopts fknrs arg; do
+while getopts d:fknrs arg; do
 	case ${arg} in
+	d)	SETSDIR=${OPTARG};;
 	f)	FORCE=true;;
 	k)	KEEP=true;;
 	n)	REBOOT=false;;
@@ -192,7 +193,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
@@ -200,7 +201,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
 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to