config-gui.sh,gui-init: Fix whiptail message box sizes to 16 60

Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
Jonathon Hall 2023-06-21 15:36:04 -04:00
parent 89858f52a9
commit 71243c1a13
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114
2 changed files with 27 additions and 25 deletions

View File

@ -16,7 +16,7 @@ read_rom() {
/bin/flash.sh -r "$1"
if [ ! -s "$1" ]; then
whiptail $BG_COLOR_ERROR --title 'ERROR: BIOS Read Failed!' \
--msgbox "Unable to read BIOS" 0 80
--msgbox "Unable to read BIOS" 16 60
exit 1
fi
}
@ -97,7 +97,7 @@ while true; do
CURRENT_OPTION=`grep 'CONFIG_BOOT_DEV=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'`
if ! fdisk -l | grep "Disk /dev/" | cut -f2 -d " " | cut -f1 -d ":" > /tmp/disklist.txt ; then
whiptail $BG_COLOR_ERROR --title 'ERROR: No bootable devices found' \
--msgbox " $ERROR\n\n" 0 80
--msgbox " $ERROR\n\n" 16 60
exit 1
fi
# filter out extraneous options
@ -128,7 +128,7 @@ while true; do
if ! mount -o ro $SELECTED_FILE /boot 2>/tmp/error ; then
ERROR=`cat /tmp/error`
whiptail $BG_COLOR_ERROR --title 'ERROR: unable to mount /boot' \
--msgbox " $ERROR\n\n" 0 80
--msgbox " $ERROR\n\n" 16 60
exit 1
fi
@ -136,7 +136,7 @@ while true; do
combine_configs
whiptail --title 'Config change successful' \
--msgbox "The /boot device was successfully changed to $SELECTED_FILE" 0 80
--msgbox "The /boot device was successfully changed to $SELECTED_FILE" 16 60
;;
"s" )
read_rom /tmp/config-gui.rom
@ -147,7 +147,7 @@ while true; do
--yesno "This will reflash your BIOS with the updated version\n\nDo you want to proceed?" 0 80) then
/bin/flash.sh /tmp/config-gui.rom
whiptail --title 'BIOS Updated Successfully' \
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 0 80
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 16 60
/bin/reboot
else
exit 0
@ -172,13 +172,15 @@ while true; do
cbfs.sh -o /tmp/config-gui.rom -d $i
done
# flash cleared ROM
/bin/flash.sh -c /tmp/config-gui.rom
# reset TPM if present
if [ "$CONFIG_TPM" = "y" ]; then
/bin/tpm-reset
fi
whiptail --title 'Configuration Reset Updated Successfully' \
--msgbox "Configuration reset and BIOS updated successfully.\n\nPress Enter to reboot" 0 80
--msgbox "Configuration reset and BIOS updated successfully.\n\nPress Enter to reboot" 16 60
/bin/reboot
else
exit 0
@ -211,7 +213,7 @@ while true; do
combine_configs
whiptail --title 'Config change successful' \
--msgbox "The root device was successfully changed to $SELECTED_FILE" 0 80
--msgbox "The root device was successfully changed to $SELECTED_FILE" 16 60
;;
"D" )
CURRENT_OPTION=`grep 'CONFIG_ROOT_DIRLIST=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'`
@ -227,7 +229,7 @@ while true; do
#check if list empty
if [ -s $NEW_CONFIG_ROOT_DIRLIST ] ; then
whiptail --title 'Config change canceled' \
--msgbox "Root device directory change canceled by user" 0 80
--msgbox "Root device directory change canceled by user" 16 60
break
fi
@ -235,7 +237,7 @@ while true; do
combine_configs
whiptail --title 'Config change successful' \
--msgbox "The root directories to hash was successfully changed to:\n$NEW_CONFIG_ROOT_DIRLIST" 0 80
--msgbox "The root directories to hash was successfully changed to:\n$NEW_CONFIG_ROOT_DIRLIST" 16 60
;;
"B" )
CURRENT_OPTION=`grep 'CONFIG_ROOT_CHECK_AT_BOOT=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'`
@ -259,7 +261,7 @@ while true; do
fi
whiptail --title 'Config change successful' \
--msgbox "The root device will be checked at each boot." 0 80
--msgbox "The root device will be checked at each boot." 16 60
fi
else
@ -271,14 +273,14 @@ while true; do
combine_configs
whiptail --title 'Config change successful' \
--msgbox "The root device will not be checked at each boot." 0 80
--msgbox "The root device will not be checked at each boot." 16 60
fi
fi
;;
"P" )
if [ "$CONFIG_RESTRICTED_BOOT" = "y" ]; then
whiptail $BG_COLOR_ERROR --title 'Restricted Boot Active' \
--msgbox "Disable Restricted Boot to enable Basic Mode." 0 80
--msgbox "Disable Restricted Boot to enable Basic Mode." 16 60
elif [ "$CONFIG_BASIC" != "y" ]; then
if (whiptail --title "Enable $CONFIG_BRAND_NAME Basic Mode?" \
--yesno "This will remove all signature checking on the firmware
@ -288,7 +290,7 @@ while true; do
set_user_config "CONFIG_BASIC" "y"
whiptail --title 'Config change successful' \
--msgbox "$CONFIG_BRAND_NAME Basic mode enabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "$CONFIG_BRAND_NAME Basic mode enabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
else
@ -300,7 +302,7 @@ while true; do
set_user_config "CONFIG_BASIC" "n"
whiptail --title 'Config change successful' \
--msgbox "$CONFIG_BRAND_NAME Basic mode has been disabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "$CONFIG_BRAND_NAME Basic mode has been disabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
fi
;;
@ -317,7 +319,7 @@ while true; do
set_user_config "CONFIG_RESTRICTED_BOOT" "y"
whiptail --title 'Config change successful' \
--msgbox "Restricted Boot mode enabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Restricted Boot mode enabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
else
@ -335,7 +337,7 @@ while true; do
if ! wipe-totp >/dev/null 2>/tmp/error; then
ERROR=$(tail -n 1 /tmp/error | fold -s)
whiptail $BG_COLOR_ERROR --title 'ERROR: erasing TOTP secret' \
--msgbox "Erasing TOTP Secret Failed\n\n${ERROR}" 0 80
--msgbox "Erasing TOTP Secret Failed\n\n${ERROR}" 16 60
exit 1
fi
@ -353,7 +355,7 @@ while true; do
/bin/flash.sh /tmp/config-gui.rom
whiptail --title 'BIOS Updated Successfully' \
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 0 80
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 16 60
/bin/reboot
fi
fi
@ -378,7 +380,7 @@ while true; do
set_user_config "CONFIG_USE_BLOB_JAIL" "n"
whiptail --title 'Config change successful' \
--msgbox "Firmware Blob Jail use has been disabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Firmware Blob Jail use has been disabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
fi
;;
@ -393,7 +395,7 @@ while true; do
set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "y"
whiptail --title 'Config change successful' \
--msgbox "Automatic default boot disabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Automatic default boot disabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
else
if (whiptail --title 'Enable automatic default boot?' \
@ -403,7 +405,7 @@ while true; do
set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "n"
whiptail --title 'Config change successful' \
--msgbox "Automatic default boot enabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Automatic default boot enabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
fi
;;
@ -417,7 +419,7 @@ while true; do
set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "y"
whiptail --title 'Config change successful' \
--msgbox "USB automatic boot enabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "USB automatic boot enabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
else
if (whiptail --title 'Disable USB automatic boot?' \
@ -427,7 +429,7 @@ while true; do
set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "n"
whiptail --title 'Config change successful' \
--msgbox "USB automatic boot disabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "USB automatic boot disabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
fi
;;
@ -440,7 +442,7 @@ while true; do
set_user_config "CONFIG_AUTOMATIC_POWERON" "y"
whiptail --title 'Config change successful' \
--msgbox "Automatic power-on enabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Automatic power-on enabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
else
if (whiptail --title 'Disable automatic power-on?' \
@ -455,7 +457,7 @@ while true; do
set_ec_poweron.sh n
whiptail --title 'Config change successful' \
--msgbox "Automatic power-on disabled;\nsave the config change and reboot for it to go into effect." 0 80
--msgbox "Automatic power-on disabled;\nsave the config change and reboot for it to go into effect." 16 60
fi
fi
;;

View File

@ -605,7 +605,7 @@ force_unsafe_boot()
{
TRACE "Under /bin/gui-init:force_unsafe_boot"
if [ "$CONFIG_RESTRICTED_BOOT" = y ]; then
whiptail $BG_COLOR_ERROR --title 'ERROR: Restricted Boot Enabled' --msgbox "Restricted Boot is Enabled, forced boot not allowed.\n\nPress OK to return to the Main Menu" 0 80
whiptail $BG_COLOR_ERROR --title 'ERROR: Restricted Boot Enabled' --msgbox "Restricted Boot is Enabled, forced boot not allowed.\n\nPress OK to return to the Main Menu" 16 60
return
fi
# Run the menu selection in "force" mode, bypassing hash checks