Path: blob/main/website/static/security/patches/EN-15:04/freebsd-update.patch
18096 views
Index: usr.sbin/freebsd-update/freebsd-update.81===================================================================2--- usr.sbin/freebsd-update/freebsd-update.8 (revision 282245)3+++ usr.sbin/freebsd-update/freebsd-update.8 (working copy)4@@ -25,7 +25,7 @@5.\"6.\" $FreeBSD$7.\"8-.Dd July 14, 20109+.Dd March 2, 201510.Dt FREEBSD-UPDATE 811.Os FreeBSD12.Sh NAME13@@ -36,10 +36,12 @@14.Op Fl b Ar basedir15.Op Fl d Ar workdir16.Op Fl f Ar conffile17+.Op Fl F18.Op Fl k Ar KEY19.Op Fl r Ar newrelease20.Op Fl s Ar server21.Op Fl t Ar address22+.Op Fl -not-running-from-cron23.Cm command ...24.Sh DESCRIPTION25The26@@ -54,16 +56,16 @@ by the27.Fx28Release Engineering Team, e.g.,29.Fx30-7.3-RELEASE and31+9.3-RELEASE and32.Fx33-8.0-RELEASE, but not34+10.1-RELEASE, but not35.Fx36-6.3-STABLE or37+9.3-STABLE or38.Fx39-9.0-CURRENT.40+11-CURRENT.41.Sh OPTIONS42The following options are supported:43-.Bl -tag -width "-f conffile"44+.Bl -tag -width "-r newrelease"45.It Fl b Ar basedir46Operate on a system mounted at47.Ar basedir .48@@ -81,6 +83,10 @@ Read configuration options from49.Ar conffile .50(default:51.Pa /etc/freebsd-update.conf )52+.It Fl F53+Force54+.Nm Cm fetch55+to proceed where it normally would not, such as an unfinished upgrade56.It Fl k Ar KEY57Trust an RSA key with SHA256 of58.Ar KEY .59@@ -98,12 +104,21 @@ Mail output of60command, if any, to61.Ar address .62(default: root, or as given in the configuration file.)63+.It Fl -not-running-from-cron64+Force65+.Nm Cm fetch66+to proceed when there is no controlling tty.67+This is for use by automated scripts and orchestration tools.68+Please do not run69+.Nm Cm fetch70+from crontab or similar using this flag, see:71+.Nm Cm cron72.El73.Sh COMMANDS74The75.Cm command76can be any one of the following:77-.Bl -tag -width "-f conffile"78+.Bl -tag -width "rollback"79.It Cm fetch80Based on the currently installed world and the configuration81options set, fetch all available binary updates.82Index: usr.sbin/freebsd-update/freebsd-update.sh83===================================================================84--- usr.sbin/freebsd-update/freebsd-update.sh (revision 282245)85+++ usr.sbin/freebsd-update/freebsd-update.sh (working copy)86@@ -43,12 +43,15 @@ Options:87(default: /var/db/freebsd-update/)88-f conffile -- Read configuration options from conffile89(default: /etc/freebsd-update.conf)90+ -F -- Force a fetch operation to proceed91-k KEY -- Trust an RSA key with SHA256 hash of KEY92-r release -- Target for upgrade (e.g., 6.2-RELEASE)93-s server -- Server from which to fetch updates94(default: update.FreeBSD.org)95-t address -- Mail output of cron command, if any, to address96(default: root)97+ --not-running-from-cron98+ -- Run without a tty, for use by automated tools99Commands:100fetch -- Fetch updates from server101cron -- Sleep rand(3600) seconds, fetch updates, and send an102@@ -399,6 +402,12 @@ init_params () {103104# No commands specified yet105COMMANDS=""106+107+ # Force fetch to proceed108+ FORCEFETCH=0109+110+ # Run without a TTY111+ NOTTYOK=0112}113114# Parse the command line115@@ -411,6 +420,12 @@ parse_cmdline () {116if [ ! -z "${CONFFILE}" ]; then usage; fi117shift; CONFFILE="$1"118;;119+ -F)120+ FORCEFETCH=1121+ ;;122+ --not-running-from-cron)123+ NOTTYOK=1124+ ;;125126# Configuration file equivalents127-b)128@@ -665,6 +680,14 @@ fetch_check_params () {129echo "(Did you mean 'upgrade' instead?)"130exit 1131fi132+133+ # Check that we have updates ready to install134+ if [ -f ${BDHASH}-install/kerneldone -a $FORCEFETCH -eq 0 ]; then135+ echo "You have a partially completed upgrade pending"136+ echo "Run '$0 install' first."137+ echo "Run '$0 fetch -F' to proceed anyway."138+ exit 1139+ fi140}141142# Perform sanity checks etc. before fetching upgrades.143@@ -3202,7 +3225,7 @@ get_params () {144# Fetch command. Make sure that we're being called145# interactively, then run fetch_check_params and fetch_run146cmd_fetch () {147- if [ ! -t 0 ]; then148+ if [ ! -t 0 -a $NOTTYOK -eq 0 ]; then149echo -n "`basename $0` fetch should not "150echo "be run non-interactively."151echo "Run `basename $0` cron instead."152153154