freebsd-update(8): Add -j flag to support jails
Make freebsd-update(8) support jails by adding the -j flag which takes a jail jid or name as an argument. This takes advantage of the recently added -j support to freebsd-version(8) in order to get the version of the installed userland. Reviewed by: dteske, kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25711
This commit is contained in:
parent
f54b18fc4d
commit
c76da1f010
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 14, 2020
|
||||
.Dd October 1, 2021
|
||||
.Dt FREEBSD-UPDATE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -37,6 +37,7 @@
|
||||
.Op Fl d Ar workdir
|
||||
.Op Fl f Ar conffile
|
||||
.Op Fl F
|
||||
.Op Fl j Ar jail
|
||||
.Op Fl k Ar KEY
|
||||
.Op Fl r Ar newrelease
|
||||
.Op Fl s Ar server
|
||||
@ -90,6 +91,14 @@ Read configuration options from
|
||||
Force
|
||||
.Nm Cm fetch
|
||||
to proceed in the case of an unfinished upgrade.
|
||||
.It Fl j Ar jail
|
||||
Operate on the given jail specified by
|
||||
.Va jid
|
||||
or
|
||||
.Va name .
|
||||
(The version of the installed userland is detected and the
|
||||
.Fl -currently-running
|
||||
option is no more required.)
|
||||
.It Fl k Ar KEY
|
||||
Trust an RSA key with SHA256 of
|
||||
.Ar KEY .
|
||||
|
@ -36,7 +36,7 @@
|
||||
# --no-stats -- don't show progress statistics while fetching files
|
||||
usage () {
|
||||
cat <<EOF
|
||||
usage: `basename $0` [options] command ... [path]
|
||||
usage: `basename $0` [options] command ...
|
||||
|
||||
Options:
|
||||
-b basedir -- Operate on a system mounted at basedir
|
||||
@ -47,6 +47,7 @@ Options:
|
||||
(default: /etc/freebsd-update.conf)
|
||||
-F -- Force a fetch operation to proceed in the
|
||||
case of an unfinished upgrade
|
||||
-j jail -- Operate on the given jail specified by jid or name
|
||||
-k KEY -- Trust an RSA key with SHA256 hash of KEY
|
||||
-r release -- Target for upgrade (e.g., 11.1-RELEASE)
|
||||
-s server -- Server from which to fetch updates
|
||||
@ -324,6 +325,19 @@ config_SourceRelease () {
|
||||
export UNAME_r
|
||||
}
|
||||
|
||||
# Get the Jail's path and the version of its installed userland
|
||||
config_TargetJail () {
|
||||
JAIL=$1
|
||||
UNAME_r=$(freebsd-version -j ${JAIL})
|
||||
BASEDIR=$(jls -j ${JAIL} -h path | awk 'NR == 2 {print}')
|
||||
if [ -z ${BASEDIR} ] || [ -z ${UNAME_r} ]; then
|
||||
echo "The specified jail either doesn't exist or" \
|
||||
"does not have freebsd-version."
|
||||
exit 1
|
||||
fi
|
||||
export UNAME_r
|
||||
}
|
||||
|
||||
# Define what happens to output of utilities
|
||||
config_VerboseLevel () {
|
||||
if [ -z ${VERBOSELEVEL} ]; then
|
||||
@ -492,6 +506,10 @@ parse_cmdline () {
|
||||
if [ $# -eq 1 ]; then usage; fi; shift
|
||||
config_WorkDir $1 || usage
|
||||
;;
|
||||
-j)
|
||||
if [ $# -eq 1 ]; then usage; fi; shift
|
||||
config_TargetJail $1 || usage
|
||||
;;
|
||||
-k)
|
||||
if [ $# -eq 1 ]; then usage; fi; shift
|
||||
config_KeyPrint $1 || usage
|
||||
|
Loading…
Reference in New Issue
Block a user