From owner-svn-src-releng@freebsd.org Thu Sep 26 20:56:08 2019 Return-Path: Delivered-To: svn-src-releng@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F65D134400; Thu, 26 Sep 2019 20:56:08 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fRzX1PXlz3xtT; Thu, 26 Sep 2019 20:56:08 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1002362B7; Thu, 26 Sep 2019 20:56:08 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QKu71D049867; Thu, 26 Sep 2019 20:56:07 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QKu7wF049866; Thu, 26 Sep 2019 20:56:07 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909262056.x8QKu7wF049866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 26 Sep 2019 20:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r352774 - releng/12.1/usr.sbin/freebsd-update X-SVN-Group: releng X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: releng/12.1/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 20:56:08 -0000 Author: grembo (ports committer) Date: Thu Sep 26 20:56:07 2019 New Revision: 352774 URL: https://svnweb.freebsd.org/changeset/base/352774 Log: MF stable/12 r352759,r352771 Approved by: re (gjb) r352759: freebsd-update.8: Style fixes, document new features. freebsd-update: Make usage output consistent. freebsd-update: Add `updatesready' and `showconfig' commands freebsd-update: Change exit code of `freebsd-update install' to 2 in case there are no pending updates and there wasn't a fetch phase in the same invocation. r352771: Add mergeinfo missing in r352759 PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Modified: releng/12.1/usr.sbin/freebsd-update/freebsd-update.8 releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- releng/12.1/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 19:48:36 2019 (r352773) +++ releng/12.1/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 20:56:07 2019 (r352774) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2017 +.Dd September 24, 2019 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -95,7 +95,7 @@ Trust an RSA key with SHA256 of .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 @@ Note that this command may require up to 500 MB of spa 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 showconfig +Show configuration options after parsing conffile and command +line options. .El .Sh TIPS .Bl -bullet Modified: releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 19:48:36 2019 (r352773) +++ releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 20:56:07 2019 (r352774) @@ -62,9 +62,11 @@ Commands: 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 + showconfig -- Show configuration EOF exit 0 } @@ -503,7 +505,8 @@ parse_cmdline () { ;; # Commands - cron | fetch | upgrade | install | rollback | IDS) + cron | fetch | upgrade | updatesready | install | rollback |\ + IDS | showconfig) COMMANDS="${COMMANDS} $1" ;; @@ -827,7 +830,7 @@ install_check_params () { 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 @@ -3333,6 +3336,21 @@ cmd_upgrade () { 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 @@ -3349,6 +3367,13 @@ cmd_rollback () { cmd_IDS () { IDS_check_params IDS_run || exit 1 +} + +# Output configuration. +cmd_showconfig () { + for X in ${CONFIGOPTIONS}; do + echo $X=$(eval echo \$${X}) + done } #### Entry point