git: 69dbc448cf8b - stable/14 - freebsd-update: Don't provide copiable commands in output

From: Michael Osipov <michaelo_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 06:50:25 UTC
The branch stable/14 has been updated by michaelo:

URL: https://cgit.FreeBSD.org/src/commit/?id=69dbc448cf8b3677e783353bcc0c2108b8a74b9d

commit 69dbc448cf8b3677e783353bcc0c2108b8a74b9d
Author:     Michael Osipov <michaelo@FreeBSD.org>
AuthorDate: 2024-01-30 16:24:45 +0000
Commit:     Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2024-04-17 06:50:07 +0000

    freebsd-update: Don't provide copiable commands in output
    
    Previously, freebsd-update provided ready-to-go commands for copying and
    pasting into the terminal. This causes problems as soon as options are
    used and not supplied again by the user, e.g., '-b' or '-d'.
    Stop making them copiable and force the user to construct a valid command
    line by himself to avoid failures.
    
    PR:             276102
    Approved by:    jrm (mentor), emaste
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D43700
---
 usr.sbin/freebsd-update/freebsd-update.sh | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index b6a8911e64b7..4a6a8d78330b 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -776,7 +776,7 @@ fetch_check_params () {
 
 	if ! [ -z "${TARGETRELEASE}" ]; then
 		echo -n "`basename $0`: "
-		echo -n "-r option is meaningless with 'fetch' command.  "
+		echo -n "'-r' option is meaningless with 'fetch' command.  "
 		echo "(Did you mean 'upgrade' instead?)"
 		exit 1
 	fi
@@ -784,8 +784,8 @@ fetch_check_params () {
 	# Check that we have updates ready to install
 	if [ -f ${BDHASH}-install/kerneldone -a $FORCEFETCH -eq 0 ]; then
 		echo "You have a partially completed upgrade pending"
-		echo "Run '$0 install' first."
-		echo "Run '$0 fetch -F' to proceed anyway."
+		echo "Run '`basename $0` [options] install' first."
+		echo "Run '`basename $0` [options] fetch -F' to proceed anyway."
 		exit 1
 	fi
 }
@@ -798,7 +798,7 @@ upgrade_check_params () {
 	NKERNCONF=${KERNCONF}
 
 	# We need TARGETRELEASE set
-	_TARGETRELEASE_z="Release target must be specified via -r option."
+	_TARGETRELEASE_z="Release target must be specified via '-r' option."
 	if [ -z "${TARGETRELEASE}" ]; then
 		echo -n "`basename $0`: "
 		echo "${_TARGETRELEASE_z}"
@@ -863,7 +863,7 @@ install_check_params () {
 	if ! [ -L ${BDHASH}-install ]; then
 		echo "No updates are available to install."
 		if [ $ISFETCHED -eq 0 ]; then
-			echo "Run '$0 fetch' first."
+			echo "Run '`basename $0` [options] fetch' first."
 			exit 2
 		fi
 		exit 0
@@ -871,7 +871,7 @@ install_check_params () {
 	if ! [ -f ${BDHASH}-install/INDEX-OLD ] ||
 	    ! [ -f ${BDHASH}-install/INDEX-NEW ]; then
 		echo "Update manifest is corrupt -- this should never happen."
-		echo "Re-run '$0 fetch'."
+		echo "Re-run '`basename $0` [options] fetch'."
 		exit 1
 	fi
 
@@ -973,7 +973,7 @@ IDS_check_params () {
 
 	_SERVERNAME_z=\
 "SERVERNAME must be given via command line or configuration file."
-	_KEYPRINT_z="Key must be given via -k option or configuration file."
+	_KEYPRINT_z="Key must be given via '-k' option or configuration file."
 	_KEYPRINT_bad="Invalid key fingerprint: "
 	_WORKDIR_bad="Directory does not exist or is not writable: "
 
@@ -2326,7 +2326,7 @@ upgrade_guess_components () {
 WARNING: This system is running a "${KCOMP}" kernel, which is not a
 kernel configuration distributed as part of FreeBSD ${RELNUM}.
 This kernel will not be updated: you MUST update the kernel manually
-before running "$0 install".
+before running '`basename $0` [options] install'.
 			EOF
 		fi
 
@@ -2770,7 +2770,7 @@ upgrade_run () {
 
 	# Remind the user that they need to run "freebsd-update install"
 	# to install the downloaded bits, in case they didn't RTFM.
-	echo "To install the downloaded upgrades, run \"$0 install\"."
+	echo "To install the downloaded upgrades, run '`basename $0` [options] install'."
 }
 
 # Make sure that all the file hashes mentioned in $@ have corresponding
@@ -2788,7 +2788,7 @@ install_verify () {
 		if ! [ -f files/${HASH}.gz ]; then
 			echo -n "Update files missing -- "
 			echo "this should never happen."
-			echo "Re-run '$0 fetch'."
+			echo "Re-run '`basename $0` [options] fetch'."
 			return 1
 		fi
 	done < filelist
@@ -3024,7 +3024,7 @@ install_files () {
 			cat <<-EOF
 
 Kernel updates have been installed.  Please reboot and run
-"$0 install" again to finish installing updates.
+'`basename $0` [options] install' again to finish installing updates.
 			EOF
 			exit 0
 		fi
@@ -3111,8 +3111,8 @@ Kernel updates have been installed.  Please reboot and run
 
 Completing this upgrade requires removing old shared object files.
 Please rebuild all installed 3rd party software (e.g., programs
-installed from the ports tree) and then run "$0 install"
-again to finish installing updates.
+installed from the ports tree) and then run
+'`basename $0` [options] install' again to finish installing updates.
 			EOF
 			rm newfiles
 			exit 0
@@ -3492,7 +3492,7 @@ cmd_updatesready () {
 	fi
 
 	echo "There are updates available to install."
-	echo "Run '$0 install' to proceed."
+	echo "Run '`basename $0` [options] install' to proceed."
 }
 
 # Install downloaded updates.