Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 2020 17:14:16 +0000 (UTC)
From:      Michael Gmelin <grembo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r364825 - stable/11/usr.sbin/freebsd-update
Message-ID:  <202008261714.07QHEGgq011788@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grembo (ports committer)
Date: Wed Aug 26 17:14:16 2020
New Revision: 364825
URL: https://svnweb.freebsd.org/changeset/base/364825

Log:
  MFC r364396: 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

Modified:
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- stable/11/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 26 17:06:16 2020	(r364824)
+++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 26 17:14:16 2020	(r364825)
@@ -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`
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008261714.07QHEGgq011788>