summaryrefslogtreecommitdiff
path: root/user/grub/grub.post-upgrade
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2019-08-18 21:46:13 -0500
committerMax Rees <maxcrees@me.com>2019-08-19 13:48:19 -0500
commit3c2ccced9f54ab390c55c89bc3a70923de7f195c (patch)
tree23ea654f30694dd46b6740431b0f9a515bfd84b2 /user/grub/grub.post-upgrade
parentf06e6ac40a9ff1dadfbc428644a76fdf71aefa74 (diff)
downloadpackages-3c2ccced9f54ab390c55c89bc3a70923de7f195c.tar.gz
packages-3c2ccced9f54ab390c55c89bc3a70923de7f195c.tar.bz2
packages-3c2ccced9f54ab390c55c89bc3a70923de7f195c.tar.xz
packages-3c2ccced9f54ab390c55c89bc3a70923de7f195c.zip
user/grub: add trigger to auto-update configuration
Diffstat (limited to 'user/grub/grub.post-upgrade')
-rw-r--r--user/grub/grub.post-upgrade38
1 files changed, 38 insertions, 0 deletions
diff --git a/user/grub/grub.post-upgrade b/user/grub/grub.post-upgrade
new file mode 100644
index 000000000..5b9cbb072
--- /dev/null
+++ b/user/grub/grub.post-upgrade
@@ -0,0 +1,38 @@
+#!/bin/sh -e
+ver_new="$1"
+ver_old="$2"
+
+if [ "$(apk version -t "$ver_old" "2.02-r8")" = "<" ]; then
+ cat >&2 <<-EOF
+ *
+ * Starting with grub=2.02-r8, /boot/grub/grub.cfg is now automatically
+ * regenerated when easy-kernel is upgraded.
+ *
+ EOF
+ if ! grep -Fqx '# DO NOT EDIT THIS FILE' /boot/grub/grub.cfg; then
+ cat >&2 <<-EOF
+ * It appears that you have a manual GRUB configuration.
+ * If this is incorrect, comment out ADELIE_MANUAL_CONFIG
+ * in /etc/default/grub. When this option is set, /boot/grub/grub.cfg
+ * will *not* be automatically regenerated.
+ *
+ EOF
+
+ cat >> /etc/default/grub <<-EOF
+ # Uncomment the following line if you do *not* want /boot/grub/grub.cfg to be
+ # automatically regenerated when easy-kernel is upgraded.
+ ADELIE_MANUAL_CONFIG=1
+ EOF
+ else
+ cat >&2 <<-EOF
+ * It appears that you have a default GRUB configuration.
+ * If this is incorrect, uncomment ADELIE_MANUAL_CONFIG=1
+ * in /etc/default/grub. When this option is set, /boot/grub/grub.cfg
+ * will *not* be automatically regenerated.
+ *
+ * A copy of the existing configuration will be saved as
+ * /boot/grub/grub.cfg.update-grub-old.
+ *
+ EOF
+ fi
+fi