svn commit: r364396 - head/usr.sbin/freebsd-update

Michael Gmelin grembo at FreeBSD.org
Wed Aug 19 15:11:28 UTC 2020


Author: grembo (ports committer)
Date: Wed Aug 19 15:11:27 2020
New Revision: 364396
URL: https://svnweb.freebsd.org/changeset/base/364396

Log:
  Unbreak `freebsd-update updatesready'.
  
  The command would only work if PWD happened to be WORKDIR.
  Also, exit 1 in case WORKDIR exists, but isn't accessible
  by the current user.
  
  PR:		242709
  Reported by:	Max Fiedler
  MFC after:	1 week

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- head/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 15:08:14 2020	(r364395)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 15:11:27 2020	(r364396)
@@ -3341,8 +3341,18 @@ cmd_upgrade () {
 	upgrade_run || exit 1
 }
 
-# Check if there are fetched updates ready to install
+# Check if there are fetched updates ready to install.
+# Chdir into the working directory.
 cmd_updatesready () {
+	# Check if working directory exists (if not, no updates pending)
+	if ! [ -e "${WORKDIR}" ]; then
+		echo "No updates are available to install."
+		exit 2
+	fi
+	
+	# Change into working directory (fail if no permission/directory etc.)
+	cd ${WORKDIR} || exit 1
+
 	# Construct a unique name from ${BASEDIR}
 	BDHASH=`echo ${BASEDIR} | sha256 -q`
 


More information about the svn-src-head mailing list