On Sat, Apr 27, 2019 at 01:23:20PM +0100, Marco Bonetti wrote:
> Hello folks,
> 
> First of all congratulations on a new OpenBSD release and thanks for
> introducing sysupgrade in -current.
> 
> Before sysupgrade, I was using a custom script for achieving the same
> result with only difference that I was checking if a new snapshot (or
> release) is available by looking at BUILDINFO before starting the
> upgrade process.
> 
> Patch below introduce the same behaviour using SHA256.sig as control
> file. If you believe there is a valid use case for reinstalling already
> applied sets to the running system please let me know and I can add a
> -f force option.

I see a need for the feature and also for the -f flag. One idea was if
you messed up your shared libs you just type sysupgrade to
unbreak things. (Doesn't quite work since not all the tools are
statically linked).

I'm not happy with comparing the sha256 file, could you please use
what(1) to compare the downloaded kernel with the running kernel?

$ sysctl -n kern.version | head -1
OpenBSD 6.5-current (GENERIC.MP) #32: Fri Apr 26 10:37:48 MDT 2019
$ what /home/_sysupgrade/bsd.mp | tail -1
        OpenBSD 6.5-current (GENERIC.MP) #32: Fri Apr 26 10:37:48 MDT 2019

You need to check if you are running MP or SP though.

I have also suggested this to Mischa, added to Cc.

> 
> Cheers,
> Marco
> 
> Index: usr.sbin/sysupgrade/sysupgrade.8
> ===================================================================
> RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
> retrieving revision 1.2
> diff -u -p -u -r1.2 sysupgrade.8
> --- usr.sbin/sysupgrade/sysupgrade.8  26 Apr 2019 05:54:49 -0000      1.2
> +++ usr.sbin/sysupgrade/sysupgrade.8  27 Apr 2019 11:54:40 -0000
> @@ -28,7 +28,7 @@
>  .Nm
>  is a utility to upgrade
>  .Ox
> -to the next release or a new snapshot.
> +to the next release or a new snapshot if available.
>  .Pp
>  .Nm
>  downloads the necessary files to
> 
> Index: usr.sbin/sysupgrade/sysupgrade.sh
> ===================================================================
> RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
> retrieving revision 1.6
> diff -u -p -u -r1.6 sysupgrade.sh
> --- usr.sbin/sysupgrade/sysupgrade.sh 26 Apr 2019 21:52:39 -0000      1.6
> +++ usr.sbin/sysupgrade/sysupgrade.sh 27 Apr 2019 11:54:48 -0000
> @@ -110,7 +110,19 @@ fi
>  
>  cd ${SETSDIR}
>  
> -unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig
> +unpriv -f SHA256.sig.tmp ftp -Vmo SHA256.sig.tmp ${URL}SHA256.sig
> +TMP_SHA=$(sha256 -q SHA256.sig.tmp)
> +
> +unpriv touch SHA256.sig
> +CUR_SHA=$(sha256 -q SHA256.sig)
> +
> +if [[ "${TMP_SHA}" = "${CUR_SHA}" ]]; then
> +     rm SHA256.sig.tmp
> +     return 0
> +fi
> +
> +unpriv cat SHA256.sig.tmp >SHA256.sig
> +rm SHA256.sig.tmp
>  
>  _KEY=openbsd-${_KERNV[0]%.*}${_KERNV[0]#*.}-base.pub
>  _NEXTKEY=openbsd-${NEXT_VERSION%.*}${NEXT_VERSION#*.}-base.pub
> 

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

Reply via email to