mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Add load_config_value() and get_config_display_action()
Add these two functions for use in config-gui.sh for future toggles. load_config_value() obtains the value of a config setting, defaulting to 'n'. get_config_display_action() displays 'Enable' or 'Disable' depending on the current value. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
606c29f0ec
commit
39c655ae1d
@ -101,3 +101,21 @@ show_system_info()
|
||||
whiptail $BG_COLOR_MAIN_MENU --title 'System Info' \
|
||||
--msgbox "${BOARD_NAME}\n\nFW_VER: ${FW_VER}\nKernel: ${kernel}\n\nCPU: ${cpustr}\nRAM: ${memtotal} GB\n$battery_status\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')" 16 60
|
||||
}
|
||||
|
||||
# Load a config value to a variable, defaulting to 'n'
|
||||
load_config_value()
|
||||
{
|
||||
local config_name="$1"
|
||||
if grep -q "$config_name" /tmp/config; then
|
||||
grep "$config_name=" /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'
|
||||
else
|
||||
echo n
|
||||
fi
|
||||
}
|
||||
|
||||
# Get "Enable" or "Disable" to display in the configuration menu, based on a
|
||||
# setting value
|
||||
get_config_display_action()
|
||||
{
|
||||
[ "$1" = "y" ] && echo "Disable" || echo "Enable"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user