freebsd-update: Add updatesready' and
showconfig' commands
`freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. See freebsd-update(8) for details. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), sectam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473
This commit is contained in:
parent
ac7bd23a7a
commit
8cfda118cb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=352662
@ -25,7 +25,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 14, 2017
|
.Dd September 24, 2019
|
||||||
.Dt FREEBSD-UPDATE 8
|
.Dt FREEBSD-UPDATE 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -155,13 +155,24 @@ Note that this command may require up to 500 MB of space in
|
|||||||
depending on which components of the
|
depending on which components of the
|
||||||
.Fx
|
.Fx
|
||||||
base system are installed.
|
base system are installed.
|
||||||
|
.It Cm updatesready
|
||||||
|
Check if there are fetched updates ready to install.
|
||||||
|
Returns exit code 2 if there are no updates to install.
|
||||||
.It Cm install
|
.It Cm install
|
||||||
Install the most recently fetched updates or upgrade.
|
Install the most recently fetched updates or upgrade.
|
||||||
|
Returns exit code 2 if there are no updates to install
|
||||||
|
and the
|
||||||
|
.Cm fetch
|
||||||
|
command wasn't passed as an earlier argument in the same
|
||||||
|
invocation.
|
||||||
.It Cm rollback
|
.It Cm rollback
|
||||||
Uninstall the most recently installed updates.
|
Uninstall the most recently installed updates.
|
||||||
.It Cm IDS
|
.It Cm IDS
|
||||||
Compare the system against a "known good" index of the
|
Compare the system against a "known good" index of the
|
||||||
installed release.
|
installed release.
|
||||||
|
.It Cm showconfig
|
||||||
|
Show configuration options after parsing conffile and command
|
||||||
|
line options.
|
||||||
.El
|
.El
|
||||||
.Sh TIPS
|
.Sh TIPS
|
||||||
.Bl -bullet
|
.Bl -bullet
|
||||||
|
@ -62,9 +62,11 @@ Commands:
|
|||||||
cron -- Sleep rand(3600) seconds, fetch updates, and send an
|
cron -- Sleep rand(3600) seconds, fetch updates, and send an
|
||||||
email if updates were found
|
email if updates were found
|
||||||
upgrade -- Fetch upgrades to FreeBSD version specified via -r option
|
upgrade -- Fetch upgrades to FreeBSD version specified via -r option
|
||||||
|
updatesready -- Check if there are fetched updates ready to install
|
||||||
install -- Install downloaded updates or upgrades
|
install -- Install downloaded updates or upgrades
|
||||||
rollback -- Uninstall most recently installed updates
|
rollback -- Uninstall most recently installed updates
|
||||||
IDS -- Compare the system against an index of "known good" files
|
IDS -- Compare the system against an index of "known good" files
|
||||||
|
showconfig -- Show configuration
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -503,7 +505,8 @@ parse_cmdline () {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
cron | fetch | upgrade | install | rollback | IDS)
|
cron | fetch | upgrade | updatesready | install | rollback |\
|
||||||
|
IDS | showconfig)
|
||||||
COMMANDS="${COMMANDS} $1"
|
COMMANDS="${COMMANDS} $1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -827,7 +830,7 @@ install_check_params () {
|
|||||||
echo "No updates are available to install."
|
echo "No updates are available to install."
|
||||||
if [ $ISFETCHED -eq 0 ]; then
|
if [ $ISFETCHED -eq 0 ]; then
|
||||||
echo "Run '$0 fetch' first."
|
echo "Run '$0 fetch' first."
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -3333,6 +3336,21 @@ cmd_upgrade () {
|
|||||||
upgrade_run || exit 1
|
upgrade_run || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if there are fetched updates ready to install
|
||||||
|
cmd_updatesready () {
|
||||||
|
# Construct a unique name from ${BASEDIR}
|
||||||
|
BDHASH=`echo ${BASEDIR} | sha256 -q`
|
||||||
|
|
||||||
|
# Check that we have updates ready to install
|
||||||
|
if ! [ -L ${BDHASH}-install ]; then
|
||||||
|
echo "No updates are available to install."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "There are updates available to install."
|
||||||
|
echo "Run '$0 install' to proceed."
|
||||||
|
}
|
||||||
|
|
||||||
# Install downloaded updates.
|
# Install downloaded updates.
|
||||||
cmd_install () {
|
cmd_install () {
|
||||||
install_check_params
|
install_check_params
|
||||||
@ -3351,6 +3369,13 @@ cmd_IDS () {
|
|||||||
IDS_run || exit 1
|
IDS_run || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Output configuration.
|
||||||
|
cmd_showconfig () {
|
||||||
|
for X in ${CONFIGOPTIONS}; do
|
||||||
|
echo $X=$(eval echo \$${X})
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
#### Entry point
|
#### Entry point
|
||||||
|
|
||||||
# Make sure we find utilities from the base system
|
# Make sure we find utilities from the base system
|
||||||
|
Loading…
Reference in New Issue
Block a user