forked from jlobue10/SteamDeck_rEFInd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestore_EFI_entries.sh
More file actions
23 lines (18 loc) · 967 Bytes
/
Copy pathrestore_EFI_entries.sh
File metadata and controls
23 lines (18 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# A simple script to restore missing SteamOS and/ or rEFInd EFI entries
efibootmgr | tee ~/efirestorelist.txt
STEAMOS_RESTORE_NUM="$(grep -A0 'SteamOS' ~/efirestorelist.txt | grep -Eo '[0-9]{1,4}' | head -1)"
REFIND_RESTORE_NUM="$(grep -A0 'rEFInd' ~/efirestorelist.txt | grep -Eo '[0-9]{1,4}' | head -1)"
re='^[0-9]+$'
if ! [[ $STEAMOS_RESTORE_NUM =~ $re ]]; then
# Recreate the missing SteamOS EFI entry
sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L "SteamOS" -l \\EFI\\steamos\\steamcl.efi
fi
if ! [[ $REFIND_RESTORE_NUM =~ $re ]]; then
# Recreate the missing rEFInd EFI entry
sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L "rEFInd" -l \\EFI\\refind\\refind_x64.efi
fi
# Forcing rEFInd to have bootnext top priority, just in case Windows EFI entry is active
sudo efibootmgr -n $(efibootmgr | grep rEFInd | grep -Eo "[0-9]{1,4}" | head -1)
yes | rm ~/efirestorelist.txt
echo -e "\nMissing EFI entries for SteamOS and/ or rEFInd have been restored.\n"