obosdi-pkg/config/boot/systemd/menu

60 lines
1.3 KiB
Text
Raw Normal View History

2019-01-02 18:00:59 -07:00
#!/bin/bash
. ./lib
options=()
options+=("Config" "/boot/loader/loader.conf")
options+=("Entries" "/boot/loader/entries")
options+=("" "")
options+=("Update" "bootctl update")
options+=("" "")
if [ ! -f /etc/pacman.d/hooks/systemd-boot.hook ]; then
options+=("Create pacman hook" "/etc/pacman.d/hooks/systemd-boot.hook")
else
options+=("Delete pacman hook" "/etc/pacman.d/hooks/systemd-boot.hook")
fi
2019-01-02 18:00:59 -07:00
defaultitem="Config"
2022-11-10 14:27:23 -07:00
sel=$(dialog --backtitle "$apptitle" --title "Systemd 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
'Config')
defaultitem="Config"
editfile /boot/loader/loader.conf
;;
'Entries')
defaultitem="Entries"
menu config/boot/systemd/entries
;;
'Update')
defaultitem="Update"
clear
bootctl update
pressanykey
;;
'Create pacman hook')
mkdir -p /etc/pacman.d/hooks
cat <<EOF > /etc/pacman.d/hooks/systemd-boot.hook
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Updating systemd-boot
When = PostTransaction
Exec = /usr/bin/bootctl update
EOF
;;
'Delete pacman hook')
rm /etc/pacman.d/hooks/systemd-boot.hook
;;
2019-01-02 18:00:59 -07:00
esac
exit 0