Date: Wed, 10 Jun 2026 12:36:05 +0000 From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: ykla <yklaxds@gmail.com> Subject: git: 9a6a2e4b7d20 - main - Warn if hostname is empty Message-ID: <6a295a35.3e007.778624b0@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a6a2e4b7d203fe9c5ea4f335564f4797bb29a01 commit 9a6a2e4b7d203fe9c5ea4f335564f4797bb29a01 Author: ykla <yklaxds@gmail.com> AuthorDate: 2025-05-18 00:19:06 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2026-06-10 12:35:02 +0000 Warn if hostname is empty Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1700 --- usr.sbin/bsdinstall/scripts/hostname | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/hostname b/usr.sbin/bsdinstall/scripts/hostname index 19df8885893b..ec58ad5dfe66 100755 --- a/usr.sbin/bsdinstall/scripts/hostname +++ b/usr.sbin/bsdinstall/scripts/hostname @@ -54,7 +54,7 @@ msg_freebsd_installer="$OSNAME Installer" msg_ok="OK" msg_please_choose_a_hostname="Please choose a hostname for this machine.\n\nIf you are running on a managed network, please ask\nyour network administrator for an appropriate name." msg_set_hostname="Set Hostname" - +msg_empty_hostname_warning="The hostname is currently empty. This is not recommended, as many network services rely on a valid hostname. Are you sure you want to continue?" # # Command strings for various tasks # @@ -97,10 +97,35 @@ f_dialog_title "$msg_set_hostname" f_dialog_backtitle "$msg_freebsd_installer" # -# Get user input +# Get user input and Warn if hostname is empty # -HOSTNAME=$( dialog_hostname "$HOSTNAME" ) -[ $? -eq $DIALOG_CANCEL ] && exit 1 +while :; do + HOSTNAME=$(dialog_hostname "$HOSTNAME") + [ $? -eq $DIALOG_CANCEL ] && exit 1 + + if [ -z "$HOSTNAME" ]; then + if [ "$USE_XDIALOG" ]; then + yes=yes no=no defaultno=defaultno + extra_args="--wrap --left" + else + yes=yes no=no defaultno=defaultno + extra_args="--colors --cr-wrap" + fi + + $DIALOG \ + --title "$DIALOG_TITLE" \ + --backtitle "$DIALOG_BACKTITLE" \ + --defaultno \ + --yes-label "$yes" \ + --no-label "$no" \ + $extra_args \ + --yesno "$msg_empty_hostname_warning" 0 0 + + [ $? -ne 0 ] && continue + fi + + break +done # # Store the user's choicehome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a295a35.3e007.778624b0>
