Re: sysupgrade change to allow installing from url

2020-05-26 Thread Florian Obser
On Tue, May 26, 2020 at 12:03:50AM +0200, Sebastian Benoit wrote:
> Solene Rapenne(sol...@perso.pw) on 2020.05.25 15:25:40 +0200:
> > 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.
> 
> I have fixed the way the directories are laid out, so now you can do this
> 
>  # echo "http://ftp.hostserver.de/archive/2020-05-14-0105; > /etc/installurl
>  # sysupgrade -n
>  # strings /home/_sysupgrade/bsd | grep 6.7-current 
> @(#)OpenBSD 6.7-current (GENERIC) #181: Wed May 13 12:43:30 MDT 2020
> 

Just for the archives, one can provide the URL on the command line,
which I think is more sensible for this particular usecase:

$ doas sysupgrade -n http://ftp.hostserver.de/archive/2020-05-14-0105
[...]
$ what /home/_sysupgrade/bsd
/home/_sysupgrade/bsd:
OpenBSD 6.7-current (GENERIC) #181: Wed May 13 12:43:30 MDT 2020

-- 
I'm not entirely sure you are real.



Re: sysupgrade change to allow installing from url

2020-05-25 Thread Sebastian Benoit
Solene Rapenne(sol...@perso.pw) on 2020.05.25 15:25:40 +0200:
> 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.

I have fixed the way the directories are laid out, so now you can do this

 # echo "http://ftp.hostserver.de/archive/2020-05-14-0105; > /etc/installurl
 # sysupgrade -n
 # strings /home/_sysupgrade/bsd | grep 6.7-current 
@(#)OpenBSD 6.7-current (GENERIC) #181: Wed May 13 12:43:30 MDT 2020


> 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 -   1.10
> +++ sysupgrade.8  25 May 2020 13:23:06 -
> @@ -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 -  1.37
> +++ sysupgrade.sh 25 May 2020 13:23:06 -
> @@ -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
> 



Re: sysupgrade change to allow installing from url

2020-05-25 Thread Jason McIntyre
On Mon, May 25, 2020 at 03:25:40PM +0200, Solene Rapenne wrote:
> 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 -   1.10
> +++ sysupgrade.8  25 May 2020 13:23:06 -
> @@ -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.

hi. i would rewrite this a little:

It is intended for installing older snapshots available which do not 
follow
the usual installurl format;
it takes precedence over
.Pa installurl .

sth like that

i don;t know whether you want to try and make it like -u url | installurl

jmc

>  .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 -  1.37
> +++ sysupgrade.sh 25 May 2020 13:23:06 -
> @@ -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
> 



sysupgrade change to allow installing from url

2020-05-25 Thread Solene Rapenne
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.83 Oct 2019 12:43:58 -   1.10
+++ sysupgrade.825 May 2020 13:23:06 -
@@ -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 -  1.37
+++ sysupgrade.sh   25 May 2020 13:23:06 -
@@ -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