On Sun, Oct 08, 2017 at 09:56:15AM +0000, Robert Peichaer wrote:
> Up to now, the upgrade procedure from one to the next release meant
> that you had to manually download and verify the new ramdisk kernel.
>
> What about if you just needed to boot into the existing bsd.rd and
> it would support downloading and verifying the bsd.rd of the next
> release?
>
> This diff changes the installer script to support such a scenario.
>
> 1) Boot the existing bsd.rd and choose (U)pgrade
> 2) Enter the "Server directory" of the new release
> The installer then offers just the bsd.rd
> The on-disk signify key of the new release is used for verify it
> 3) Reboot into the new bsd.rd and do the upgrade
>
>
> An important assumption for this to work properly is:
>
> Upgrades are only supported from one release to the release
> immediately following it. [1]
>
>
> It would look like this for the 6.2 to 6.3 upgrade situation.
> (The version numbers are obviously faked)
>
> Let's upgrade the sets!
> Location of sets? (cd0 disk http or 'done') [http]
> HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
> HTTP Server? (hostname, list#, 'done' or '?') [ftp.hostserver.de]
> Server directory? [pub/OpenBSD/6.2/amd64] pub/OpenBSD/6.3/amd64
> Unable to get a verified list of distribution sets.
>
> Select sets by entering a set name, a file name pattern or 'all'. De-select
> sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
> [X] bsd.rd
> Set name(s)? (or 'abort' or 'done') [done]
> Get/Verify SHA256.sig 100% |**************************| 2152 00:00
> Signature Verified
> Get/Verify bsd.rd 100% |**************************| 9565 KB 00:14
> Installing bsd.rd 100% |**************************| 9565 KB 00:00
> Location of sets? (cd0 disk http or 'done') [done]
> Making all device nodes...done.
>
> CONGRATULATIONS! Your OpenBSD upgrade has been successfully completed!
> To boot the new system, enter 'reboot' at the command prompt.
>
>
> Here's the diff and below is a more detailed description.
Well, here's a diff, that actually works.
Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1036
diff -u -p -p -u -r1.1036 install.sub
--- install.sub 4 Oct 2017 18:19:33 -0000 1.1036
+++ install.sub 9 Oct 2017 17:41:59 -0000
@@ -1330,6 +1330,15 @@ sane_install() {
#
select_sets() {
local _avail=$1 _selected=$2 _f _action _col=$COLUMNS
+ local _bsd_rd _no_sets=true
+
+ if [[ $MODE == upgrade ]]; then
+ for _f in $_avail; do
+ [[ $_f != bsd* ]] && _no_sets=false
+ [[ $_f == bsd.rd* ]] && _bsd_rd=$_f
+ done
+ $_no_sets && UPGRADE_BSDRD=true _avail=$_bsd_rd
_selected=$_bsd_rd
+ fi
# account for 4 spaces added to the sets list
let COLUMNS=_col-8
@@ -1516,6 +1525,9 @@ install_files() {
! $_unpriv ftp -D "$_t" -Vmo - "$_src/SHA256.sig"
>"$_cfile.sig" &&
_issue="Cannot fetch SHA256.sig" && break
+ $UPGRADE_BSDRD &&
+ PUB_KEY=/mnt/etc/signify/openbsd-$((VERSION +
1))-base.pub
+
# Verify signature file with public keys.
! unpriv -f "$_cfile" \
signify -Vep $PUB_KEY -x "$_cfile.sig" -m "$_cfile" &&
@@ -1576,7 +1588,9 @@ install_files() {
tar -zxphf - -C /mnt
fi
;;
- *) $_unpriv ftp -D Installing -Vmo - "$_fsrc" >"/mnt/$_f"
+ *) $UPGRADE_BSDRD && [[ $_f == bsd.rd* ]] &&
+ cp /mnt/$_f /mnt/$_f.old.$VERSION
+ $_unpriv ftp -D Installing -Vmo - "$_fsrc" >"/mnt/$_f"
;;
esac
if (($?)); then
@@ -1587,6 +1601,7 @@ install_files() {
fi
else
DEFAULTSETS=$(rmel $_f $DEFAULTSETS)
+ $UPGRADE_BSDRD && DEFAULTSETS=
fi
[[ -d $_tmpsrc ]] && rm -f "$_tmpsrc/$_f"
done
@@ -3139,6 +3154,7 @@ PUB_KEY=/etc/signify/openbsd-${VERSION}-
ROOTDEV=
ROOTDISK=
SETDIR="$VNAME/$ARCH"
+UPGRADE_BSDRD=false
V4_DHCPCONF=false
V6_AUTOCONF=false
WLANLIST=/tmp/i/wlanlist
===================================================================
Stats: --- 1 lines 60 chars
Stats: +++ 17 lines 525 chars
Stats: 16 lines
Stats: 465 chars
--
-=[rpe]=-