Merge pull request #791 from MrChromebox/gui_boot_tweaks

GUI / Boot Device Tweaks
This commit is contained in:
tlaurion 2020-08-06 16:13:21 -04:00 committed by GitHub
commit 3aa919ade9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -36,7 +36,7 @@ while true; do
> /tmp/boot_device_list.txt
for i in `cat /tmp/disklist.txt`; do
# remove block device from list if numeric partitions exist, since not bootable
let DEV_NUM_PARTITIONS=`ls -1 $i* | wc -l`-1
DEV_NUM_PARTITIONS=$((`ls -1 $i* | wc -l`-1))
if [ ${DEV_NUM_PARTITIONS} -eq 0 ]; then
echo $i >> /tmp/boot_device_list.txt
else
@ -52,18 +52,21 @@ while true; do
SELECTED_FILE=$FILE
fi
replace_config /etc/config.user "CONFIG_BOOT_DEV" "$SELECTED_FILE"
combine_configs
# unmount /boot if needed
if grep -q /boot /proc/mounts ; then
umount /boot 2>/dev/null
fi
# mount newly selected /boot device
if ! ( umount /boot 2>/tmp/error && \
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`
whiptail $CONFIG_ERROR_BG_COLOR --title 'ERROR: unable to mount /boot' \
--msgbox "Unable to un/re-mount /boot:\n\n$ERROR" 16 60
--msgbox " $ERROR\n\n" 16 60
exit 1
fi
replace_config /etc/config.user "CONFIG_BOOT_DEV" "$SELECTED_FILE"
combine_configs
whiptail --title 'Config change successful' \
--msgbox "The /boot device was successfully changed to $SELECTED_FILE" 16 60
;;

View File

@ -47,7 +47,7 @@ verify_global_hashes()
elif [ ! -f $TMP_HASH_FILE ]; then
if (whiptail $CONFIG_ERROR_BG_COLOR --clear --title 'ERROR: Missing Hash File!' \
--yesno "The file containing hashes for /boot is missing!\n\nIf you are setting this system up for the first time, select Yes to update\nyour list of checksums.\n\nOtherwise this could indicate a compromise and you should select No to\nreturn to the main menu.\n\nWould you like to update your checksums now?" 30 90) then
prompt_update_checksums
update_checksums
fi
return 1
else
@ -74,7 +74,7 @@ verify_global_hashes()
fi
if (whiptail $CONFIG_ERROR_BG_COLOR --clear --title 'ERROR: Boot Hash Mismatch' --yesno "$TEXT" 30 90) then
prompt_update_checksums
update_checksums
fi
return 1
fi

View File

@ -322,7 +322,7 @@ detect_boot_device()
> /tmp/boot_device_list
for i in `cat /tmp/disklist`; do
# remove block device from list if numeric partitions exist, since not bootable
let DEV_NUM_PARTITIONS=`ls -1 $i* | wc -l`-1
DEV_NUM_PARTITIONS=$((`ls -1 $i* | wc -l`-1))
if [ ${DEV_NUM_PARTITIONS} -eq 0 ]; then
echo $i >> /tmp/boot_device_list
else