Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2018 01:06:03 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339756 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <201810260106.w9Q16371073766@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Fri Oct 26 01:06:03 2018
New Revision: 339756
URL: https://svnweb.freebsd.org/changeset/base/339756

Log:
  Add improved error checking to bsdinstall hostname
  
  Sponsored by:	Smule, Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/hostname

Modified: head/usr.sbin/bsdinstall/scripts/hostname
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/hostname	Fri Oct 26 00:08:27 2018	(r339755)
+++ head/usr.sbin/bsdinstall/scripts/hostname	Fri Oct 26 01:06:03 2018	(r339756)
@@ -56,6 +56,12 @@ msg_please_choose_a_hostname="Please choose a hostname
 msg_ok="OK"
 msg_freebsd_installer="FreeBSD Installer"
 
+#
+# Command strings for various tasks
+#
+ECHO_OVERWRITE='echo "%s" > "%s"'
+SET_HOSTNAME='hostname -s "%s"'
+
 ############################################################ FUNCTIONS
 
 # dialog_hostname
@@ -100,14 +106,15 @@ HOSTNAME=$( dialog_hostname "$HOSTNAME" )
 #
 # Store the user's choice
 #
-echo "hostname=\"$HOSTNAME\"" > "$HOSTNAMEFILE"
+f_eval_catch "$pgm" echo "$ECHO_OVERWRITE" \
+	'hostname=\"$HOSTNAME\"' "$HOSTNAMEFILE"
 retval=$?
 
 #
 # Activate entry if configured
 #
 if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
-	hostname -s "$HOSTNAME"
+	f_eval_catch "$pgm" hostname "$SET_HOSTNAME" "$HOSTNAME"
 	retval=$?
 fi
 



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