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

36 lines
999 B
Fish
Executable file

#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function installSW -V dir
yayinst secureboot-grub
end
function configureSW -V dir
source "$dir/../../../Common/Scripts/config.fish"
set -l label (getOSConfig boot.label)
set -l efiDir (getOSConfig boot.efiMountPoint)
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)" \
-e "d" \
-e "}" \
-e "/bootloader_id=/{" \
-e "a bootloader_id=$(echo "$label" | string escape)" \
-e "d" \
-e "}" \
/etc/secureboot.conf
sudo secure-grub-install
end
runInstaller --force $argv
end