Updated Installation script

The password checking for a new user now works and prompts to set a password for the deck user if one has not already been set. The script now also checks for a duplicate rEFInd EFI boot entry from previous script runs and deletes it (if found). The script can now be run back to back without any intermediate steps. If reinstalling Windows, still disable the rEFInd EFI entry beforehand (as described in the README).
This commit is contained in:
jlobue10 2022-10-06 22:45:34 -07:00 committed by GitHub
parent f3e968fc18
commit 0f6ead0ef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,20 @@
#!/bin/bash
# A simple Steam Deck rEFInd automated install script
sudo btrfs property set -ts / ro false
passwd --status deck | tee ~/deck_passwd_status.txt
awk '{
if($2 =="P")
{
print "Password is already set.";
}
else
{
print "Password has not been set. Please set password for deck user now.";
system("passwd");
}
}' ~/deck_passwd_status.txt
sudo steamos-readonly disable
sudo pacman-key --init
sudo pacman-key --populate archlinux
yes | sudo pacman -S refind
@ -12,11 +25,21 @@ grep -A0 'Windows' ~/efibootlist.txt | tee ~/windows_boot.txt
WINDOWS_BOOTNUM="$(grep -Eo '[0-9]{1,}' ~/windows_boot.txt)"
# Disable Windows EFI boot entry
sudo efibootmgr -b $WINDOWS_BOOTNUM -A
#grep -A0 'rEFInd Boot Manager' ~/efibootlist.txt | tee ~/rEFInd_boot.txt
grep -A0 'rEFInd' ~/efibootlist.txt | tee ~/rEFInd_boot.txt
grep -A0 'rEFInd Boot Manager' ~/efibootlist.txt | tee ~/rEFInd_boot.txt
REFIND_BOOTNUM="$(grep -Eo '[0-9]{1,}' ~/rEFInd_boot.txt)"
# Delete rEFInd EFI boot entry from rEFInd-install... will be re-added later pointing to esp partition
sudo efibootmgr -b $REFIND_BOOTNUM -B
# Checking for duplicate rEFInd EFI boot entry, from previous script runs (or other sources)
efibootmgr | tee ~/efibootlist2.txt
grep -A0 'rEFInd' ~/efibootlist2.txt | tee ~/rEFInd_boot2.txt
REFIND_BOOTNUM_ALT="$(grep -Eo '[0-9]{1,}' ~/rEFInd_boot2.txt)"
# Deleting duplicate rEFInd boot entry, if one was found
re='^[0-9]+$'
if [[ $REFIND_BOOTNUM_ALT =~ $re ]]; then
sudo efibootmgr -b $REFIND_BOOTNUM_ALT -B
fi
yes | sudo cp -rf /boot/efi/EFI/refind/ /esp/efi
# Renaming default rEFInd config file to keep for reference and backup
sudo mv /esp/efi/refind/refind.conf /esp/efi/refind/refind-bkp.conf
@ -29,8 +52,10 @@ sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L "rEFInd" -l \\efi\\refind\\refind_x64
# Clean up temporary files
yes | rm ~/deck_passwd_status.txt
yes | rm ~/efibootlist.txt
yes | rm ~/efibootlist2.txt
yes | rm ~/windows_boot.txt
yes | rm ~/rEFInd_boot.txt
yes | rm ~/rEFInd_boot2.txt
sudo btrfs property set -ts / ro true
sudo steamos-readonly enable
echo "rEFInd has now been installed."