From 71243c1a138639f17550a7bffe25d656735367a8 Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Wed, 21 Jun 2023 15:36:04 -0400 Subject: [PATCH] config-gui.sh,gui-init: Fix whiptail message box sizes to 16 60 Signed-off-by: Jonathon Hall --- initrd/bin/config-gui.sh | 50 +++++++++++++++++++++------------------- initrd/bin/gui-init | 2 +- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/initrd/bin/config-gui.sh b/initrd/bin/config-gui.sh index e6a892c8..3e3f238e 100755 --- a/initrd/bin/config-gui.sh +++ b/initrd/bin/config-gui.sh @@ -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 ;; diff --git a/initrd/bin/gui-init b/initrd/bin/gui-init index 398270ea..b3729c1c 100755 --- a/initrd/bin/gui-init +++ b/initrd/bin/gui-init @@ -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