fix: more robust way to extract efi partition and parent device (fixes #63)

This commit is contained in:
oddlama 2022-12-20 13:07:17 +01:00
parent 133fe3901a
commit 2a2ef9abd7
No known key found for this signature in database
GPG Key ID: 14EFE510775FE39A
1 changed files with 9 additions and 3 deletions

View File

@ -209,10 +209,16 @@ function install_kernel_efi() {
|| die "Could not resolve device with id=$DISK_ID_EFI" || die "Could not resolve device with id=$DISK_ID_EFI"
efipartdev="$(realpath "$efipartdev")" \ efipartdev="$(realpath "$efipartdev")" \
|| die "Error in realpath '$efipartdev'" || die "Error in realpath '$efipartdev'"
local efipartnum="${efipartdev: -1}" local efipartnum
efipartnum="$(cat "$efipartdev/partition")" \
|| die "Failed to find partition number for EFI partition $efipartdev"
local gptdev local gptdev
gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}")" \ gptdev="/dev/$(basename "$(readlink -f "$efipartdev/..")")" \
|| die "Could not resolve device with id=${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}" || die "Failed to find parent device for EFI partition $efipartdev"
if [[ ! -e "$gptdev" ]] || [[ -z "$gptdev" ]]; then
gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}")" \
|| die "Could not resolve device with id=${DISK_ID_PART_TO_GPT_ID[$DISK_ID_EFI]}"
fi
try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\vmlinuz.efi' --unicode 'initrd=\initramfs.img'" $(get_cmdline)" try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\vmlinuz.efi' --unicode 'initrd=\initramfs.img'" $(get_cmdline)"
# Create script to repeat adding efibootmgr entry # Create script to repeat adding efibootmgr entry