PortValhalla/scripts/Arch/Config/SecureBoot/main.fish
2024-11-29 01:15:08 +01:00

35 lines
982 B
Fish
Executable file

#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../lib/software.fish"
function installSW -V dir
yayinst secureboot-grub
end
function configureSW -V dir
source "$dir/../../../lib/settings.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