Page MenuHomeFreeBSD

D21473.id61864.diff
No OneTemporary

D21473.id61864.diff

Index: usr.sbin/freebsd-update/freebsd-update.8
===================================================================
--- usr.sbin/freebsd-update/freebsd-update.8
+++ usr.sbin/freebsd-update/freebsd-update.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 14, 2017
+.Dd August 30, 2019
.Dt FREEBSD-UPDATE 8
.Os
.Sh NAME
@@ -95,7 +95,7 @@
.Ar KEY .
(default: read value from configuration file.)
.It Fl r Ar newrelease
-Specify the new release (e.g. 11.2-RELEASE) to which
+Specify the new release (e.g., 11.2-RELEASE) to which
.Nm
should upgrade (upgrade command only).
.It Fl s Ar server
@@ -155,13 +155,24 @@
depending on which components of the
.Fx
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
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
Uninstall the most recently installed updates.
.It Cm IDS
Compare the system against a "known good" index of the
installed release.
+.It Cm config
+Show configuration options after parsing conffile and command
+line options.
.El
.Sh TIPS
.Bl -bullet
Index: usr.sbin/freebsd-update/freebsd-update.sh
===================================================================
--- usr.sbin/freebsd-update/freebsd-update.sh
+++ usr.sbin/freebsd-update/freebsd-update.sh
@@ -62,9 +62,11 @@
cron -- Sleep rand(3600) seconds, fetch updates, and send an
email if updates were found
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
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
+ config -- Show configuration
EOF
exit 0
}
@@ -495,7 +497,8 @@
;;
# Commands
- cron | fetch | upgrade | install | rollback | IDS)
+ cron | fetch | upgrade | updatesready | install | rollback |\
+ IDS | config)
COMMANDS="${COMMANDS} $1"
;;
@@ -819,7 +822,7 @@
echo "No updates are available to install."
if [ $ISFETCHED -eq 0 ]; then
echo "Run '$0 fetch' first."
- exit 1
+ exit 2
fi
exit 0
fi
@@ -3324,6 +3327,21 @@
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.
cmd_install () {
install_check_params
@@ -3342,6 +3360,13 @@
IDS_run || exit 1
}
+# Output configuration.
+cmd_config () {
+ for X in ${CONFIGOPTIONS}; do
+ echo $X=$(eval echo \$${X})
+ done
+}
+
#### Entry point
# Make sure we find utilities from the base system

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 27, 1:01 AM (3 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26237526
Default Alt Text
D21473.id61864.diff (3 KB)

Event Timeline