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" /bin/flash.sh -r "$1"
if [ ! -s "$1" ]; then if [ ! -s "$1" ]; then
whiptail $BG_COLOR_ERROR --title 'ERROR: BIOS Read Failed!' \ 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 exit 1
fi fi
} }
@ -97,7 +97,7 @@ while true; do
CURRENT_OPTION=`grep 'CONFIG_BOOT_DEV=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'` 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 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' \ whiptail $BG_COLOR_ERROR --title 'ERROR: No bootable devices found' \
--msgbox " $ERROR\n\n" 0 80 --msgbox " $ERROR\n\n" 16 60
exit 1 exit 1
fi fi
# filter out extraneous options # filter out extraneous options
@ -128,7 +128,7 @@ while true; do
if ! mount -o ro $SELECTED_FILE /boot 2>/tmp/error ; then if ! mount -o ro $SELECTED_FILE /boot 2>/tmp/error ; then
ERROR=`cat /tmp/error` ERROR=`cat /tmp/error`
whiptail $BG_COLOR_ERROR --title 'ERROR: unable to mount /boot' \ whiptail $BG_COLOR_ERROR --title 'ERROR: unable to mount /boot' \
--msgbox " $ERROR\n\n" 0 80 --msgbox " $ERROR\n\n" 16 60
exit 1 exit 1
fi fi
@ -136,7 +136,7 @@ while true; do
combine_configs combine_configs
whiptail --title 'Config change successful' \ 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" ) "s" )
read_rom /tmp/config-gui.rom 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 --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 /bin/flash.sh /tmp/config-gui.rom
whiptail --title 'BIOS Updated Successfully' \ 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 /bin/reboot
else else
exit 0 exit 0
@ -172,13 +172,15 @@ while true; do
cbfs.sh -o /tmp/config-gui.rom -d $i cbfs.sh -o /tmp/config-gui.rom -d $i
done done
# flash cleared ROM # flash cleared ROM
/bin/flash.sh -c /tmp/config-gui.rom /bin/flash.sh -c /tmp/config-gui.rom
# reset TPM if present # reset TPM if present
if [ "$CONFIG_TPM" = "y" ]; then if [ "$CONFIG_TPM" = "y" ]; then
/bin/tpm-reset /bin/tpm-reset
fi fi
whiptail --title 'Configuration Reset Updated Successfully' \ 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 /bin/reboot
else else
exit 0 exit 0
@ -211,7 +213,7 @@ while true; do
combine_configs combine_configs
whiptail --title 'Config change successful' \ 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" ) "D" )
CURRENT_OPTION=`grep 'CONFIG_ROOT_DIRLIST=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -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 #check if list empty
if [ -s $NEW_CONFIG_ROOT_DIRLIST ] ; then if [ -s $NEW_CONFIG_ROOT_DIRLIST ] ; then
whiptail --title 'Config change canceled' \ 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 break
fi fi
@ -235,7 +237,7 @@ while true; do
combine_configs combine_configs
whiptail --title 'Config change successful' \ 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" ) "B" )
CURRENT_OPTION=`grep 'CONFIG_ROOT_CHECK_AT_BOOT=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'` 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 fi
whiptail --title 'Config change successful' \ 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 fi
else else
@ -271,14 +273,14 @@ while true; do
combine_configs combine_configs
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;
"P" ) "P" )
if [ "$CONFIG_RESTRICTED_BOOT" = "y" ]; then if [ "$CONFIG_RESTRICTED_BOOT" = "y" ]; then
whiptail $BG_COLOR_ERROR --title 'Restricted Boot Active' \ 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 elif [ "$CONFIG_BASIC" != "y" ]; then
if (whiptail --title "Enable $CONFIG_BRAND_NAME Basic Mode?" \ if (whiptail --title "Enable $CONFIG_BRAND_NAME Basic Mode?" \
--yesno "This will remove all signature checking on the firmware --yesno "This will remove all signature checking on the firmware
@ -288,7 +290,7 @@ while true; do
set_user_config "CONFIG_BASIC" "y" set_user_config "CONFIG_BASIC" "y"
whiptail --title 'Config change successful' \ 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 fi
else else
@ -300,7 +302,7 @@ while true; do
set_user_config "CONFIG_BASIC" "n" set_user_config "CONFIG_BASIC" "n"
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;
@ -317,7 +319,7 @@ while true; do
set_user_config "CONFIG_RESTRICTED_BOOT" "y" set_user_config "CONFIG_RESTRICTED_BOOT" "y"
whiptail --title 'Config change successful' \ 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 fi
else else
@ -335,7 +337,7 @@ while true; do
if ! wipe-totp >/dev/null 2>/tmp/error; then if ! wipe-totp >/dev/null 2>/tmp/error; then
ERROR=$(tail -n 1 /tmp/error | fold -s) ERROR=$(tail -n 1 /tmp/error | fold -s)
whiptail $BG_COLOR_ERROR --title 'ERROR: erasing TOTP secret' \ 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 exit 1
fi fi
@ -353,7 +355,7 @@ while true; do
/bin/flash.sh /tmp/config-gui.rom /bin/flash.sh /tmp/config-gui.rom
whiptail --title 'BIOS Updated Successfully' \ 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 /bin/reboot
fi fi
fi fi
@ -378,7 +380,7 @@ while true; do
set_user_config "CONFIG_USE_BLOB_JAIL" "n" set_user_config "CONFIG_USE_BLOB_JAIL" "n"
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;
@ -393,7 +395,7 @@ while true; do
set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "y" set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "y"
whiptail --title 'Config change successful' \ 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 fi
else else
if (whiptail --title 'Enable automatic default boot?' \ if (whiptail --title 'Enable automatic default boot?' \
@ -403,7 +405,7 @@ while true; do
set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "n" set_user_config "CONFIG_BASIC_NO_AUTOMATIC_DEFAULT" "n"
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;
@ -417,7 +419,7 @@ while true; do
set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "y" set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "y"
whiptail --title 'Config change successful' \ 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 fi
else else
if (whiptail --title 'Disable USB automatic boot?' \ if (whiptail --title 'Disable USB automatic boot?' \
@ -427,7 +429,7 @@ while true; do
set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "n" set_user_config "CONFIG_BASIC_USB_AUTOBOOT" "n"
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;
@ -440,7 +442,7 @@ while true; do
set_user_config "CONFIG_AUTOMATIC_POWERON" "y" set_user_config "CONFIG_AUTOMATIC_POWERON" "y"
whiptail --title 'Config change successful' \ 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 fi
else else
if (whiptail --title 'Disable automatic power-on?' \ if (whiptail --title 'Disable automatic power-on?' \
@ -455,7 +457,7 @@ while true; do
set_ec_poweron.sh n set_ec_poweron.sh n
whiptail --title 'Config change successful' \ 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
fi fi
;; ;;

View File

@ -605,7 +605,7 @@ force_unsafe_boot()
{ {
TRACE "Under /bin/gui-init:force_unsafe_boot" TRACE "Under /bin/gui-init:force_unsafe_boot"
if [ "$CONFIG_RESTRICTED_BOOT" = y ]; then 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 return
fi fi
# Run the menu selection in "force" mode, bypassing hash checks # Run the menu selection in "force" mode, bypassing hash checks