Hello,
This patch adds two new options to sysupgrade. The first option is for small
box systems like an APU system that only has the base and manual sets
installed. The second option is for headless systems without X11 like servers.
I have tested this patch from the 6.5 release to 6.6 release to current for
both the minimal and no X11 options. In order to test, I did remove the ftp -N
option which is not present in the 6.5 or 6.6 releases. I also tested
sysupgrade without invoking either new option from 6.5 to 6.6 to current for
regression. All of these tests resulted in a successful upgrade.
I also repeated the above tests from a full install to minimal and base
installs and, of course, the system is broken after such an upgrade. While it
is possible to check for the presence of clang or xinit to guess if the
requested upgrade is safe, I believe it would still only be a guess that
couldn't eliminate all the creative ways someone could break their
installation. If anyone has a suggestion for how to address this problem I am
willing to work on it and submit an updated patch.
Thank you to all the OpenBSD developers for the incredible work you do every
day on OpenBSD and for sharing your work.
James
Index: sysupgrade.sh
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.37
diff -u -p -u -p -r1.37 sysupgrade.sh
--- sysupgrade.sh 26 Jan 2020 22:08:36 -0000 1.37
+++ sysupgrade.sh 30 Apr 2020 03:07:15 -0000
@@ -34,7 +34,7 @@ ug_err()
usage()
{
- ug_err "usage: ${0##*/} [-fkn] [-r | -s] [installurl]"
+ ug_err "usage: ${0##*/} [-fkn] [-r | -s] [-x | -z] [installurl]"
}
unpriv()
@@ -78,14 +78,18 @@ SNAP=false
FORCE=false
KEEP=false
REBOOT=true
+NOX11=false
+MINIMAL=false
-while getopts fknrs arg; do
+while getopts fknrsxz arg; do
case ${arg} in
f) FORCE=true;;
k) KEEP=true;;
n) REBOOT=false;;
r) RELEASE=true;;
s) SNAP=true;;
+ x) NOX11=true;;
+ z) MINIMAL=true;;
*) usage;;
esac
done
@@ -96,6 +100,10 @@ if $RELEASE && $SNAP; then
usage
fi
+if $MINIMAL && $NOX11; then
+ usage
+fi
+
set -A _KERNV -- $(sysctl -n kern.version |
sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
@@ -152,9 +160,19 @@ if cmp -s /var/db/installed.SHA256 SHA25
exit 0
fi
+if $MINIMAL; then
+# INSTALL.*, bsd*, base*, man*
+ SETS=$(sed -n -e 's/^SHA256 (\(.*\)) .*/\1/' \
+ -e '/^INSTALL\./p;/^bsd/p;/^base/p;/^man/p' SHA256)
+elif $NOX11; then
+# INSTALL.*, bsd*, *.tgz without x*
+ SETS=$(sed -n -e 's/^SHA256 (\(.*\)) .*/\1/' \
+ -e '/^INSTALL\./p;/^bsd/p;/^x/d;/\.tgz$/p' SHA256)
+else
# INSTALL.*, bsd*, *.tgz
-SETS=$(sed -n -e 's/^SHA256 (\(.*\)) .*/\1/' \
- -e '/^INSTALL\./p;/^bsd/p;/\.tgz$/p' SHA256)
+ SETS=$(sed -n -e 's/^SHA256 (\(.*\)) .*/\1/' \
+ -e '/^INSTALL\./p;/^bsd/p;/\.tgz$/p' SHA256)
+fi
OLD_FILES=$(ls)
OLD_FILES=$(rmel SHA256 $OLD_FILES)
Index: sysupgrade.8
===================================================================
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 sysupgrade.8
--- sysupgrade.8 3 Oct 2019 12:43:58 -0000 1.10
+++ sysupgrade.8 30 Apr 2020 03:07:30 -0000
@@ -24,6 +24,7 @@
.Nm
.Op Fl fkn
.Op Fl r | s
+.Op Fl x | z
.Op Ar installurl
.Sh DESCRIPTION
.Nm
@@ -66,6 +67,16 @@ 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 x
+Perform an upgrade of the kernel and all sets except the X11 sets.
+This option will render your system
+.Sy unusable
+if the current installation includes other sets.
+.It Fl z
+Perform an upgrade of the kernel and base and manual sets.
+This option will render your system
+.Sy unusable
+if the current installation includes other sets.
.El
.Sh FILES
.Bl -tag -width "/auto_upgrade.conf" -compact