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
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to