Hi,

I don't know if this will be accepted but I propose to add a -u [url]
parameter to use older snapshots from an archive server for example.

I wanted to add an optional parameter to -s at first but in case of
sysupgrade -s [installurl] the install url would have been mistaken by
this.

If you specify a -u url and installurl at the same time, -u url
superseed installurl.

This would allow easier bisecting using older snapshots.

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        25 May 2020 13:23:06 -0000
@@ -24,6 +24,7 @@
 .Nm
 .Op Fl fkn
 .Op Fl r | s
+.Op Fl u Pa url
 .Op Ar installurl
 .Sh DESCRIPTION
 .Nm
@@ -66,6 +67,13 @@ This is the default if the system is cur
 .It Fl s
 Upgrade to a snapshot.
 This is the default if the system is currently running a snapshot.
+.It Fl u Pa url
+Fetch and verify the files downloaded from 
+.Pa url .
+This is superseeding
+.Op Pa installurl ,
+its usage is intended for installing older snapshots available under url not 
following
+the usual installurl format.
 .El
 .Sh FILES
 .Bl -tag -width "/auto_upgrade.conf" -compact
Index: sysupgrade.sh
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.37
diff -u -p -r1.37 sysupgrade.sh
--- sysupgrade.sh       26 Jan 2020 22:08:36 -0000      1.37
+++ sysupgrade.sh       25 May 2020 13:23:06 -0000
@@ -34,7 +34,7 @@ ug_err()
 
 usage()
 {
-       ug_err "usage: ${0##*/} [-fkn] [-r | -s] [installurl]"
+       ug_err "usage: ${0##*/} [-fkn] [-r | -s] [-u url] [installurl]"
 }
 
 unpriv()
@@ -79,13 +79,14 @@ FORCE=false
 KEEP=false
 REBOOT=true
 
-while getopts fknrs arg; do
+while getopts fknrsu: arg; do
        case ${arg} in
        f)      FORCE=true;;
        k)      KEEP=true;;
        n)      REBOOT=false;;
        r)      RELEASE=true;;
        s)      SNAP=true;;
+       u)      SNAPURL=${OPTARG};;
        *)      usage;;
        esac
 done
@@ -121,7 +122,11 @@ else
 fi
 
 if $SNAP; then
-       URL=${MIRROR}/snapshots/${ARCH}/
+       if [[ -n "$SNAPURL" ]]; then
+           URL=$SNAPURL
+       else
+           URL=${MIRROR}/snapshots/${ARCH}/
+       fi
 else
        URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/
 fi

Reply via email to