mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-30 01:38:56 +00:00
config-gui: filter out invalid boot device options
use similar filtering logic as with USB drives to provide the user a more sane list of boot device options. Show user only valid bootable partitions, not block devices. There's no point in showing /dev/nvme0 and /dev/nvme0n1 (eg) when /dev/nvme0n1p[1..n] (eg) exist, as the former are not valid boot devices. Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
parent
34394032de
commit
c982be5bd4
@ -76,8 +76,21 @@ while true; do
|
|||||||
;;
|
;;
|
||||||
"b" )
|
"b" )
|
||||||
CURRENT_OPTION=`grep 'CONFIG_BOOT_DEV=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'`
|
CURRENT_OPTION=`grep 'CONFIG_BOOT_DEV=' /tmp/config | tail -n1 | cut -f2 -d '=' | tr -d '"'`
|
||||||
find /dev -name 'sd*' -o -name 'nvme*' > /tmp/filelist.txt
|
fdisk -l | grep "Disk" | cut -f2 -d " " | cut -f1 -d ":" > /tmp/disklist.txt
|
||||||
file_selector "/tmp/filelist.txt" "Choose the default /boot device.\n\nCurrently set to $CURRENT_OPTION."
|
# filter out extraneous options
|
||||||
|
> /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
|
||||||
|
if [ ${DEV_NUM_PARTITIONS} -eq 0 ]; then
|
||||||
|
echo $i >> /tmp/boot_device_list.txt
|
||||||
|
else
|
||||||
|
ls $i* | tail -${DEV_NUM_PARTITIONS} >> /tmp/boot_device_list.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
file_selector "/tmp/boot_device_list.txt" \
|
||||||
|
"Choose the default /boot device.\n\nCurrently set to $CURRENT_OPTION." \
|
||||||
|
"Boot Device Selection"
|
||||||
if [ "$FILE" == "" ]; then
|
if [ "$FILE" == "" ]; then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user