From 70d249ae4651753776798f429c050bf618038a03 Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Wed, 10 Jan 2024 17:09:57 -0500 Subject: [PATCH] intird/bin/config-gui.sh: Clarify root hash menu item, minor cleanup Say the action to take in the menu (enable or disable) instead of just "Check root hashes at boot". Clean up some use of load_config_value, set_config, combine_configs. Get config values from the environment directly. set_user_config does set_config and combine_configs. Signed-off-by: Jonathon Hall --- initrd/bin/config-gui.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/initrd/bin/config-gui.sh b/initrd/bin/config-gui.sh index 24a940ba..f3183867 100755 --- a/initrd/bin/config-gui.sh +++ b/initrd/bin/config-gui.sh @@ -39,7 +39,7 @@ while true; do 'r' ' Clear GPG key(s) and reset all user settings' 'R' ' Change the root device for hashing' 'D' ' Change the root directories to hash' - 'B' ' Check root hashes at boot' + 'B' " $(get_config_display_action "$CONFIG_ROOT_CHECK_AT_BOOT") root check at boot" 'L' " $(get_config_display_action "$CONFIG_RESTRICTED_BOOT") Restricted Boot" ) @@ -255,10 +255,9 @@ while true; do --msgbox "The root directories to hash was successfully changed to:\n$NEW_CONFIG_ROOT_DIRLIST" 0 80 ;; "B" ) - CURRENT_OPTION="$(load_config_value CONFIG_ROOT_CHECK_AT_BOOT)" - if [ "$CURRENT_OPTION" != "y" ]; then + if [ "$CONFIG_ROOT_CHECK_AT_BOOT" != "y" ]; then # Root device and directories must be set to enable this - if [ -z "$(load_config_value CONFIG_ROOT_DEV)" ] || [ -z "$(load_config_value CONFIG_ROOT_DIRLIST)" ]; then + if [ -z "$CONFIG_ROOT_DEV" ] || [ -z "$CONFIG_ROOT_DIRLIST" ]; then whiptail $BG_COLOR_ERROR --title 'Root Check Not Configured' \ --msgbox "Set the root device and directories to hash before enabling this feature." 0 80 elif (whiptail --title 'Enable Root Hash Check at Boot?' \ @@ -267,8 +266,7 @@ while true; do \na minute or more to the boot time. \n\nDo you want to proceed?" 0 80) then - set_config /etc/config.user "CONFIG_ROOT_CHECK_AT_BOOT" "y" - combine_configs + set_user_config "CONFIG_ROOT_CHECK_AT_BOOT" "y" # check that root hash file exists if [ ! -f ${ROOT_HASH_FILE} ]; then @@ -288,8 +286,7 @@ while true; do --yesno "This will disable checking root hashes each time you boot. \n\nDo you want to proceed?" 0 80) then - set_config /etc/config.user "CONFIG_ROOT_CHECK_AT_BOOT" "n" - combine_configs + set_user_config "CONFIG_ROOT_CHECK_AT_BOOT" "n" whiptail --title 'Config change successful' \ --msgbox "The root device will not be checked at each boot." 0 80