From a2f9df0607b3af41c956bffc3ffc5b20e1f34f9d Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 4 Jan 2019 00:29:58 +0100 Subject: [PATCH] refind: add pacman hook --- config/boot/refind/menu | 40 +++++++++++++++++++++++++++++++++++----- config/boot/systemd/menu | 2 -- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/config/boot/refind/menu b/config/boot/refind/menu index 6844d9d..8584c82 100644 --- a/config/boot/refind/menu +++ b/config/boot/refind/menu @@ -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 < /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 diff --git a/config/boot/systemd/menu b/config/boot/systemd/menu index 2814bed..0c3f804 100644 --- a/config/boot/systemd/menu +++ b/config/boot/systemd/menu @@ -38,7 +38,6 @@ case $sel in pressanykey ;; 'Create pacman hook') - defaultitem="Update" mkdir -p /etc/pacman.d/hooks cat < /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