mirror of
https://github.com/rocky-linux/rocky-tools.git
synced 2024-11-22 13:11:26 +00:00
Fix EFI boot to work with mdadm-mirrored partitions. (#68)
* Fix EFI boot to work with mdadm-mirrored partitions.
This commit is contained in:
parent
f014318b79
commit
64fd6b5f08
@ -350,13 +350,38 @@ collect_system_info () {
|
|||||||
# Check the efi mount first, so we can bail before wasting time on all these
|
# Check the efi mount first, so we can bail before wasting time on all these
|
||||||
# other checks if it's not there.
|
# other checks if it's not there.
|
||||||
if [[ $update_efi ]]; then
|
if [[ $update_efi ]]; then
|
||||||
local efi_mount
|
local efi_mount kname
|
||||||
declare -g efi_disk efi_partition
|
declare -g -a efi_disk efi_partition
|
||||||
efi_mount=$(findmnt --mountpoint /boot/efi --output SOURCE \
|
efi_mount=$(findmnt --mountpoint /boot/efi --output SOURCE \
|
||||||
--noheadings) ||
|
--noheadings) ||
|
||||||
exit_message "Can't find EFI mount. No EFI boot detected."
|
exit_message "Can't find EFI mount. No EFI boot detected."
|
||||||
efi_disk=/dev/$(lsblk -no pkname "$efi_mount")
|
kname=$(lsblk -dno kname "$efi_mount")
|
||||||
efi_partition=$(<"/sys/block/${efi_disk##*/}/${efi_mount##*/}/partition")
|
efi_disk=$(lsblk -dno pkname "/dev/$kname")
|
||||||
|
|
||||||
|
if [[ $efi_disk ]]; then
|
||||||
|
efi_partition=$(<"/sys/block/$efi_disk/$kname/partition")
|
||||||
|
else
|
||||||
|
# This is likely an md-raid or other type of virtual disk, we need
|
||||||
|
# to dig a little deeper to find the actual physical disks and
|
||||||
|
# partitions.
|
||||||
|
kname=$(lsblk -dno kname "$efi_mount")
|
||||||
|
cd "/sys/block/$kname/slaves" || exit_message \
|
||||||
|
"Unable to gather EFI data: Can't cd to /sys/block/$kname/slaves."
|
||||||
|
if ! (shopt -s failglob; : *) 2>/dev/null; then
|
||||||
|
exit_message \
|
||||||
|
"Unable to gather EFI data: No slaves found in /sys/block/$kname/slaves."
|
||||||
|
fi
|
||||||
|
efi_disk=()
|
||||||
|
for d in *; do
|
||||||
|
efi_disk+=("$(lsblk -dno pkname "/dev/$d")")
|
||||||
|
efi_partition+=("$(<"$d/partition")")
|
||||||
|
if [[ ! ${efi_disk[-1]} || ! ${efi_partition[-1]} ]]; then
|
||||||
|
exit_message \
|
||||||
|
"Unable to gather EFI data: Can't find disk name or partition number for $d."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd -
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if EFI secure boot is enabled
|
# check if EFI secure boot is enabled
|
||||||
@ -792,9 +817,11 @@ efi_check () {
|
|||||||
fix_efi () (
|
fix_efi () (
|
||||||
grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg ||
|
grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg ||
|
||||||
exit_message "Error updating the grub config."
|
exit_message "Error updating the grub config."
|
||||||
efibootmgr -c -d "$efi_disk" -p "$efi_partition" -L "Rocky Linux" \
|
for i in "${!efi_disk[@]}"; do
|
||||||
-l /EFI/rocky/grubx64.efi ||
|
efibootmgr -c -d "/dev/${efi_disk[$i]}" -p "${efi_partition[$i]}" \
|
||||||
|
-L "Rocky Linux" -l /EFI/rocky/grubx64.efi ||
|
||||||
exit_message "Error updating uEFI firmware."
|
exit_message "Error updating uEFI firmware."
|
||||||
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
# Download and verify the Rocky Linux package signing key
|
# Download and verify the Rocky Linux package signing key
|
||||||
|
Loading…
Reference in New Issue
Block a user