refind: add pacman hook

This commit is contained in:
MatMoul 2019-01-04 00:29:58 +01:00
parent ea4ed5e757
commit a2f9df0607
2 changed files with 35 additions and 7 deletions

View file

@ -2,10 +2,18 @@
. ./lib
options=()
options+=("config" "/boot/refind_linux.conf")
options+=("global config" "/boot/refind_linux.conf")
options+=("Config" "/boot/refind_linux.conf")
options+=("Global config" "/boot/refind_linux.conf")
options+=("" "")
options+=("Update" "refind-install")
options+=("" "")
if [ ! -f /etc/pacman.d/hooks/refind.hook ]; then
options+=("Create pacman hook" "/etc/pacman.d/hooks/refind.hook")
else
options+=("Delete pacman hook" "/etc/pacman.d/hooks/refind.hook")
fi
defaultitem=""
defaultitem="Config"
sel=$(whiptail --backtitle "$apptitle" --title "rEFInd Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
@ -15,8 +23,30 @@ fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
'config') editfile /boot/refind_linux.conf;;
'global config') editfile /boot/EFI/refind/refind.conf;;
'Config') editfile /boot/refind_linux.conf;;
'Global config') editfile /boot/EFI/refind/refind.conf;;
'Update')
clear
refind-install
pressanykey
;;
'Create pacman hook')
mkdir -p /etc/pacman.d/hooks
cat <<EOF > /etc/pacman.d/hooks/refind.hook
[Trigger]
Operation=Upgrade
Type=Package
Target=refind-efi
[Action]
Description = Updating rEFInd on ESP
When=PostTransaction
Exec=/usr/bin/refind-install
EOF
;;
'Delete pacman hook')
rm /etc/pacman.d/hooks/refind.hook
;;
esac
exit 0

View file

@ -38,7 +38,6 @@ case $sel in
pressanykey
;;
'Create pacman hook')
defaultitem="Update"
mkdir -p /etc/pacman.d/hooks
cat <<EOF > /etc/pacman.d/hooks/systemd-boot.hook
[Trigger]
@ -53,7 +52,6 @@ Exec = /usr/bin/bootctl update
EOF
;;
'Delete pacman hook')
defaultitem="Update"
rm /etc/pacman.d/hooks/systemd-boot.hook
;;
esac