Fix dialog autosizing in bsdinstall auto error messages
Sponsored by: Smule, Inc.
This commit is contained in:
parent
224df38669
commit
f0c98fded6
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user