summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysupgrade
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-05-03 15:18:14 +0000
committerflorian <florian@openbsd.org>2019-05-03 15:18:14 +0000
commit0ac72bf6766b2f1586799a780095760652699b10 (patch)
treecda6f239a589534ffd2b20aa38e6aa1e05c5dfad /usr.sbin/sysupgrade
parentMake sure that the as-set name is not too long when parsing the config file. (diff)
downloadwireguard-openbsd-0ac72bf6766b2f1586799a780095760652699b10.tar.xz
wireguard-openbsd-0ac72bf6766b2f1586799a780095760652699b10.zip
Rename -c to -s since the correct term is snapshot, not current. Also
implement -r for symetry reasons to force an upgrade to the next release. suggested by & OK deraadt, OK benno, kmos
Diffstat (limited to 'usr.sbin/sysupgrade')
-rw-r--r--usr.sbin/sysupgrade/sysupgrade.825
-rw-r--r--usr.sbin/sysupgrade/sysupgrade.sh23
2 files changed, 30 insertions, 18 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.8 b/usr.sbin/sysupgrade/sysupgrade.8
index 7104a269c54..329f8b81f31 100644
--- a/usr.sbin/sysupgrade/sysupgrade.8
+++ b/usr.sbin/sysupgrade/sysupgrade.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysupgrade.8,v 1.4 2019/05/03 14:44:19 ian Exp $
+.\" $OpenBSD: sysupgrade.8,v 1.5 2019/05/03 15:18:14 florian Exp $
.\"
.\" Copyright (c) 2019 Florian Obser <florian@openbsd.org>
.\"
@@ -22,9 +22,8 @@
.Nd upgrade system to the next release or a new snapshot
.Sh SYNOPSIS
.Nm
-.Op Fl c
-.Op Fl f
-.Op Fl n
+.Op Fl fn
+.Op Fl r | s
.Op Ar installurl
.Sh DESCRIPTION
.Nm
@@ -49,12 +48,6 @@ triggering a one-shot upgrade using the files in
.Pp
The options are as follows:
.Bl -tag -width Ds
-.It Fl c
-upgrade to a snapshot.
-The default is to find out if the system is running a release or a snapshot.
-In case of release
-.Nm
-downloads the next release.
.It Fl f
force an already applied upgrade.
The default is to upgrade to latest snapshot only if available.
@@ -63,6 +56,18 @@ This option has no effect on releases.
fetch and verify the files and create
.Pa /bsd.upgrade
but not do reboot.
+.It Fl r
+upgrade to the next release.
+The default is to find out if the system is running a release or a snapshot.
+In case of release
+.Nm
+downloads the next release.
+.It Fl s
+upgrade to a snapshot.
+The default is to find out if the system is running a release or a snapshot.
+In case of release
+.Nm
+downloads the next release.
.El
.Sh FILES
.Bl -tag -width "/home/_sysupgrade" -compact
diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh
index 474ead0c842..e265c411123 100644
--- a/usr.sbin/sysupgrade/sysupgrade.sh
+++ b/usr.sbin/sysupgrade/sysupgrade.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: sysupgrade.sh,v 1.11 2019/05/03 14:48:13 ian Exp $
+# $OpenBSD: sysupgrade.sh,v 1.12 2019/05/03 15:18:14 florian Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org>
@@ -33,7 +33,7 @@ ug_err()
usage()
{
- ug_err "usage: ${0##*/} [-cfn] [installurl]"
+ ug_err "usage: ${0##*/} [-fn] [-r | -s] [installurl]"
}
unpriv()
@@ -62,19 +62,25 @@ rmel() {
echo -n "$_c"
}
-CURRENT=false
+RELEASE=false
+SNAP=false
FORCE=false
REBOOT=true
-while getopts cfn arg; do
+while getopts fnrs arg; do
case ${arg} in
- c) CURRENT=true;;
f) FORCE=true;;
n) REBOOT=false;;
+ r) RELEASE=true;;
+ s) SNAP=true;;
*) usage;;
esac
done
+if $RELEASE && $SNAP; then
+ usage
+fi
+
set -A _KERNV -- $(sysctl -n kern.version |
sed 's/^OpenBSD \([0-9]\)\.\([0-9]\)\([^ ]*\).*/\1.\2 \3/;q')
@@ -89,12 +95,13 @@ case $# in
*) usage
esac
-if [[ ${#_KERNV[*]} == 2 ]]; then
- CURRENT=true
+if ! $RELEASE && [[ ${#_KERNV[*]} == 2 ]]; then
+ SNAP=true
fi
+
NEXT_VERSION=$(echo ${_KERNV[0]} + 0.1 | bc)
-if $CURRENT; then
+if $SNAP; then
URL=${MIRROR}/snapshots/${ARCH}/
else
URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/