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 <jonathon.hall@puri.sm>
This commit is contained in:
Jonathon Hall 2024-01-10 17:09:57 -05:00
parent de1592e2f5
commit 70d249ae46
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114

View File

@ -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