You've already forked osfv-test-data
mirror of
https://github.com/Dasharo/osfv-test-data.git
synced 2026-06-13 19:16:20 -07:00
Merge pull request #13 from Dasharo/fix-installing-uefi-shell-on-nvme
deploy-shell-efi.sh: Fix partition num breaking when /boot/efi on nvme0n1p1
This commit is contained in:
@@ -36,10 +36,22 @@ cp "$SHELL_EFI_SRC" "$DEST_EFI"
|
||||
|
||||
PART_DEV=$(findmnt -no SOURCE "$ESP")
|
||||
DISK=$(lsblk -no PKNAME "$PART_DEV" | head -n1)
|
||||
PART_NUM=$(echo "$PART_DEV" | sed 's/[^0-9]*//g')
|
||||
PART_NUM=$(echo "$PART_DEV" | sed -E 's/.*[^0-9]([0-9]+)$/\1/')
|
||||
DISK_DEV="/dev/$DISK"
|
||||
LABEL="UEFI Shell"
|
||||
|
||||
echo "Registering UEFI boot entry..."
|
||||
# Remove existing UEFI Shell entries
|
||||
efibootmgr | grep "$LABEL" | while IFS= read -r line; do
|
||||
# Extract the boot number Boot0003 -> 0003
|
||||
bootnum=$(echo "$line" | grep -oP 'Boot\K[0-9A-Fa-f]{4}')
|
||||
# If nonzero
|
||||
if [[ -n "$bootnum" ]]; then
|
||||
echo Removing UEFI Shell at $bootnum
|
||||
sudo efibootmgr -b "$bootnum" -B &> /dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Registering UEFI boot entry at $DISK_DEV part $PART_NUM"
|
||||
efibootmgr --create --disk "$DISK_DEV" --part "$PART_NUM" \
|
||||
--label "UEFI Shell" --loader '\EFI\Shell\Shell.efi'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user