Add a new option which allows to set an alternative base-directory to

download the installation files to.  This is helpful if the default
base-directory /home isn't available for writing, i.e. when using auto
mounted home directories.

Discussed with and input received from
florian@, jmc@, sthen@, schwarze@, and ajacoutot@.

OK florian@, jmc@, sthen@
This commit is contained in:
mglocker 2022-06-08 09:03:11 +00:00
parent c41db53663
commit fa02c594c6
2 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sysupgrade.8,v 1.12 2021/11/08 16:12:10 kn Exp $
.\" $OpenBSD: sysupgrade.8,v 1.13 2022/06/08 09:03:11 mglocker 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: November 8 2021 $
.Dd $Mdocdate: June 8 2022 $
.Dt SYSUPGRADE 8
.Os
.Sh NAME
@ -24,6 +24,7 @@
.Nm
.Op Fl fkn
.Op Fl r | s
.Op Fl b Ar base-directory
.Op Ar installurl
.Sh DESCRIPTION
.Nm
@ -48,6 +49,11 @@ triggering a one-shot upgrade using the files in
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl b Ar base-directory
Download files to
.Ar base-directory Ns / Ns Pa _sysupgrade
instead of
.Pa /home/_sysupgrade .
.It Fl f
Force an already applied upgrade.
The default is to upgrade to latest snapshot only if available.

View File

@ -1,6 +1,6 @@
#!/bin/ksh
#
# $OpenBSD: sysupgrade.sh,v 1.47 2022/06/02 07:44:18 florian Exp $
# $OpenBSD: sysupgrade.sh,v 1.48 2022/06/08 09:03:11 mglocker Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org>
@ -35,7 +35,7 @@ err()
usage()
{
echo "usage: ${0##*/} [-fkn] [-r | -s] [installurl]" 1>&2
echo "usage: ${0##*/} [-fkn] [-r | -s] [-b base-directory] [installurl]" 1>&2
return 1
}
@ -78,8 +78,9 @@ FORCE=false
KEEP=false
REBOOT=true
while getopts fknrs arg; do
while getopts b:fknrs arg; do
case ${arg} in
b) SETSDIR=${OPTARG}/_sysupgrade;;
f) FORCE=true;;
k) KEEP=true;;
n) REBOOT=false;;