diff options
author | Devin Teske <dteske@FreeBSD.org> | 2018-10-26 02:08:44 +0000 |
---|---|---|
committer | Devin Teske <dteske@FreeBSD.org> | 2018-10-26 02:08:44 +0000 |
commit | f0c98fded66c68d9156b0636f7a2e0146f235649 (patch) | |
tree | 14dbbcbf26c9f8b5eb37d56bbf400e0b2c0a8583 | |
parent | 224df38669786e220666d51eb19c6fabc2c9593d (diff) | |
download | src-f0c98fded66c68d9156b0636f7a2e0146f235649.tar.gz src-f0c98fded66c68d9156b0636f7a2e0146f235649.zip |
Fix dialog autosizing in bsdinstall auto error messages
Sponsored by: Smule, Inc.
Notes
Notes:
svn path=/head/; revision=339760
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/auto | 66 |
1 files changed, 47 insertions, 19 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index f86ccb62c179..6fc664a62f55 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2011 Nathan Whitehorn -# Copyright (c) 2013 Devin Teske +# Copyright (c) 2013-2018 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,31 +33,59 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_include $BSDCFG_SHARE/dialog.subr -############################################################ FUNCTIONS - -error() { - local msg - if [ -n "$1" ]; then - msg="$1\n\n" - fi - test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR - test -f $PATH_FSTAB && bsdinstall umount - dialog --backtitle "FreeBSD Installer" --title "Abort" \ - --no-label "Exit" --yes-label "Restart" --yesno \ - "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0 - if [ $? -ne 0 ]; then - exit 1 - else - exec $0 - fi -} +############################################################ GLOBALS +# +# Strings that should be moved to an i18n file and loaded with f_include_lang() +# hline_arrows_tab_enter="Press arrows, TAB or ENTER" +hline_arrows_tab_space_enter="Press arrows, TAB, SPACE or ENTER" +msg_abort="Abort" +msg_exit="Exit" +msg_freebsd_installer="FreeBSD Installer" msg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?" msg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?" +msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?" msg_no="NO" +msg_restart="Restart" msg_yes="YES" +############################################################ FUNCTIONS + +# error [$msg] +# +# Display generic error message when a script fails. An optional message +# argument can preceed the generic message. User is given the choice of +# restarting the installer or exiting. +# +error() +{ + local title="$msg_abort" + local btitle="$msg_freebsd_installer" + local prompt="${1:+$1\n\n}$msg_an_installation_step_has_been_aborted" + local hline="$hline_arrows_tab_space_enter" + + [ "$DISTDIR_IS_UNIONFS" ] && umount -f "$BSDINSTALL_DISTDIR" + [ -f "$PATH_FSTAB" ] && bsdinstall umount + + local height width + f_dialog_buttonbox_size height width \ + "$title" "$btitle" "$prompt" "$hline" + + if $DIALOG \ + --title "$title" \ + --backtitle "$btitle" \ + --hline "$hline" \ + --no-label "$msg_exit" \ + --yes-label "$msg_restart" \ + --yesno "$prompt" $height $width + then + exec $0 + # NOTREACHED + fi + exit 1 +} + # dialog_workaround # # Ask the user if they wish to apply a workaround |