diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/modules/hdmap | 36 | ||||
-rw-r--r-- | backend/modules/partitions | 18 |
2 files changed, 52 insertions, 2 deletions
diff --git a/backend/modules/hdmap b/backend/modules/hdmap index ec7af08..09e2b91 100644 --- a/backend/modules/hdmap +++ b/backend/modules/hdmap @@ -326,10 +326,42 @@ function fill_hdmap() hdmap_set "$( ( echo "$cfg_hdmap" - root_disk="$(get_disk "$(hdmap_get device of mountpoint /)")" + root_disk="$(get_disk "$(hdmap_get device of mountpoint /)")" + efi_part="$(hdmap_get device of mountpoint /boot/efi)" + for part in $(list_efi_partitions | grep "$root_disk"; list_efi_partitions | grep -v "$root_disk") + do + # prefer EFI partition on root disk + if [ -z "$efi_part" ]; then + # preselect the first of the EFI partitions found + echo "$part:/boot/efi::auto" + efi_part="$part" + else + # list other possible EFI partitions in hdmap but don't select them + echo "$part:::" + fi + done for part in $(list_partitions -usage filesystem) do - if is_removeable "$part" && [ "$(get_disk "$part")" != "$root_disk" ]; then + disk="$(get_disk "$part")" + if [ -z "$efi_part" ] && [ "$disk" = "$root_disk" ] && \ + [ "$(get_filesystem_type $part)" = "DOS" ]; then + case "$(blkid -p -s PTTYPE -o value "$disk")" in + gpt) + efi_part="$part" + ;; + dos) + # only primary MSDOS partitions can be EFI partitions + partnr="${part/$disk}" + partnr="${partnr//[^0-9]}" + [ -n "$partnr" -a "$partnr" -ge 1 -a "$partnr" -le 4 ] && efi_part="$part" + ;; + esac + if [ "$efi_part" ]; then + echo "$efi_part:/boot/efi::auto" + continue + fi + fi + if is_removeable "$part" && [ "$disk" != "$root_disk" ]; then echo "$part:::" else echo "$part:/media/$(basename "$part")::auto" diff --git a/backend/modules/partitions b/backend/modules/partitions index b586d17..9af0b96 100644 --- a/backend/modules/partitions +++ b/backend/modules/partitions @@ -169,6 +169,24 @@ function list_linux_partitions() ) | sort -u } +# Synopsis: list_efi_partitions +# +# This function lists all partitions from the disks (by list_all_disks) which have partition Id 0xef (= EFI) and DOS filesystem +# Output example: +# /dev/sda1 +# /dev/sdb1 +function list_linux_partitions() +{ + for part in $(list_all_partitions) + do + case "$(blkid -p -s PART_ENTRY_TYPE -o value "$part")" in + 0xef|c12a7328-f81f-11d2-ba4b-00a0c93ec93b) + [ "$(get_filesystem_type $part)" = "DOS" ] && echo "$part" + ;; + esac + done +} + # Synopsis: list_swap_partitions # # This function lists all partitions or lvm from the disks (by list_all_disks) which have partition Id 0x82 (= Linux swap) |