refind: add pacman hook
This commit is contained in:
parent
ea4ed5e757
commit
a2f9df0607
2 changed files with 35 additions and 7 deletions
|
@ -2,10 +2,18 @@
|
||||||
. ./lib
|
. ./lib
|
||||||
|
|
||||||
options=()
|
options=()
|
||||||
options+=("config" "/boot/refind_linux.conf")
|
options+=("Config" "/boot/refind_linux.conf")
|
||||||
options+=("global 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 \
|
sel=$(whiptail --backtitle "$apptitle" --title "rEFInd Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
|
||||||
"${options[@]}" \
|
"${options[@]}" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
@ -15,8 +23,30 @@ fi
|
||||||
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
||||||
|
|
||||||
case $sel in
|
case $sel in
|
||||||
'config') editfile /boot/refind_linux.conf;;
|
'Config') editfile /boot/refind_linux.conf;;
|
||||||
'global config') editfile /boot/EFI/refind/refind.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
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -38,7 +38,6 @@ case $sel in
|
||||||
pressanykey
|
pressanykey
|
||||||
;;
|
;;
|
||||||
'Create pacman hook')
|
'Create pacman hook')
|
||||||
defaultitem="Update"
|
|
||||||
mkdir -p /etc/pacman.d/hooks
|
mkdir -p /etc/pacman.d/hooks
|
||||||
cat <<EOF > /etc/pacman.d/hooks/systemd-boot.hook
|
cat <<EOF > /etc/pacman.d/hooks/systemd-boot.hook
|
||||||
[Trigger]
|
[Trigger]
|
||||||
|
@ -53,7 +52,6 @@ Exec = /usr/bin/bootctl update
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
'Delete pacman hook')
|
'Delete pacman hook')
|
||||||
defaultitem="Update"
|
|
||||||
rm /etc/pacman.d/hooks/systemd-boot.hook
|
rm /etc/pacman.d/hooks/systemd-boot.hook
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue