From owner-svn-src-head@freebsd.org Fri Oct 26 01:06:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D80110D0535; Fri, 26 Oct 2018 01:06:04 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D8557B93C; Fri, 26 Oct 2018 01:06:04 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E23F719D24; Fri, 26 Oct 2018 01:06:03 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9Q163b3073767; Fri, 26 Oct 2018 01:06:03 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9Q16371073766; Fri, 26 Oct 2018 01:06:03 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201810260106.w9Q16371073766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Fri, 26 Oct 2018 01:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339756 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 339756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 01:06:04 -0000 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