obosdi-pkg/config/boot/refind/menu

53 lines
1.2 KiB
Text
Raw Permalink Normal View History

2019-01-02 18:00:59 -07:00
#!/bin/bash
. ./lib
options=()
2019-01-03 16:29:58 -07:00
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
2019-01-02 18:00:59 -07:00
2019-01-03 16:29:58 -07:00
defaultitem="Config"
2022-11-10 14:27:23 -07:00
sel=$(dialog --backtitle "$apptitle" --title "rEFInd Config Menu :" --default-item "$defaultitem" --cancel-button "Back" --menu "" 0 0 0 \
2019-01-02 18:00:59 -07:00
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
2019-01-03 16:29:58 -07:00
'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
;;
2019-01-02 18:00:59 -07:00
esac
exit 0