diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-05-03 13:04:41 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-05-03 13:04:41 +0000 |
commit | b6de72e29e73fb4b7fd5440dba1e46a8af405ded (patch) | |
tree | b0315a4571931f39a2bc2cf3d600a8a36a80d2aa /usr.sbin/sysupgrade | |
parent | 9c4af60600bc9e56955267dad5029c02748699d7 (diff) |
Only fetch and upgrade if a new snapshot is available.
Based on a diff by Marco Bonetti (sid77 AT slackware.it).
discussed with deraadt@, OK kn
Diffstat (limited to 'usr.sbin/sysupgrade')
-rw-r--r-- | usr.sbin/sysupgrade/sysupgrade.8 | 11 | ||||
-rw-r--r-- | usr.sbin/sysupgrade/sysupgrade.sh | 22 |
2 files changed, 22 insertions, 11 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.8 b/usr.sbin/sysupgrade/sysupgrade.8 index 88c8a43b034..27d3d3143c3 100644 --- a/usr.sbin/sysupgrade/sysupgrade.8 +++ b/usr.sbin/sysupgrade/sysupgrade.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysupgrade.8,v 1.2 2019/04/26 05:54:49 jmc Exp $ +.\" $OpenBSD: sysupgrade.8,v 1.3 2019/05/03 13:04:40 florian Exp $ .\" .\" Copyright (c) 2019 Florian Obser <florian@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 26 2019 $ +.Dd $Mdocdate: May 3 2019 $ .Dt SYSUPGRADE 8 .Os .Sh NAME @@ -23,12 +23,13 @@ .Sh SYNOPSIS .Nm .Op Fl c +.Op Fl f .Op Ar installurl .Sh DESCRIPTION .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 @@ -52,6 +53,10 @@ 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. +This option has no effect on releases. .El .Sh FILES .Bl -tag -width "/home/_sysupgrade" -compact diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index e532d7f94d1..7225b0d840f 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.8 2019/04/29 22:27:39 ian Exp $ +# $OpenBSD: sysupgrade.sh,v 1.9 2019/05/03 13:04:40 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##*/} [-c] [installurl]" + ug_err "usage: ${0##*/} [-cf] [installurl]" } unpriv() @@ -63,12 +63,14 @@ rmel() { } CURRENT=false - -while getopts c arg; do - case ${arg} in - c) CURRENT=true;; - *) usage;; - esac +FORCE=false + +while getopts cf arg; do + case ${arg} in + c) CURRENT=true;; + f) FORCE=true;; + *) usage;; + esac done set -A _KERNV -- $(sysctl -n kern.version | @@ -112,6 +114,10 @@ cd ${SETSDIR} unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig +if cmp -s /var/db/installed.SHA256.sig SHA256.sig && ! $FORCE; then + ug_err "Already on latest snapshot." +fi + _KEY=openbsd-${_KERNV[0]%.*}${_KERNV[0]#*.}-base.pub _NEXTKEY=openbsd-${NEXT_VERSION%.*}${NEXT_VERSION#*.}-base.pub |