PortValhalla/scripts/Arch/Config/SecureBoot/main.fish

36 lines
982 B
Fish
Raw Normal View History

2024-09-19 22:56:56 +00:00
#!/bin/env fish
begin
set -l dir (status dirname)
2024-11-01 12:12:16 +00:00
source "$dir/../../lib/software.fish"
2024-09-19 22:56:56 +00:00
function installSW -V dir
yayinst secureboot-grub
end
function configureSW -V dir
2024-11-01 12:12:16 +00:00
source "$dir/../../../lib/settings.fish"
2024-09-22 15:50:05 +00:00
set -l label (getOSConfig boot.label)
set -l efiDir (getOSConfig boot.efiMountPoint)
2024-09-19 22:56:56 +00:00
set -l bootNums (efibootmgr | sed "/$label/{ s/^.*Boot\([[:digit:]]\+\)\*.*\$/\1/; p; }; d")
for bootNum in $bootNums
sudo efibootmgr --delete-bootnum --bootnum $bootNum
end
sudo sed -i \
-e "/esp=/{" \
-e "a esp=$(echo "$efiDir" | string escape)" \
2024-11-29 00:13:58 +00:00
-e d \
2024-09-19 22:56:56 +00:00
-e "}" \
-e "/bootloader_id=/{" \
-e "a bootloader_id=$(echo "$label" | string escape)" \
2024-11-29 00:13:58 +00:00
-e d \
2024-09-19 22:56:56 +00:00
-e "}" \
/etc/secureboot.conf
sudo secure-grub-install
end
2024-10-13 23:55:19 +00:00
runInstaller --force $argv
2024-09-19 22:56:56 +00:00
end