summaryrefslogtreecommitdiff
path: root/user/grub
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
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')
-rw-r--r--user/grub/APKBUILD12
-rw-r--r--user/grub/default-grub4
-rw-r--r--user/grub/grub.post-upgrade38
-rw-r--r--user/grub/grub.trigger2
-rw-r--r--user/grub/update-grub14
5 files changed, 68 insertions, 2 deletions
diff --git a/user/grub/APKBUILD b/user/grub/APKBUILD
index 9d6ada6fd..24e998e53 100644
--- a/user/grub/APKBUILD
+++ b/user/grub/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=grub
pkgver=2.02
-pkgrel=7
+pkgrel=8
pkgdesc="Bootloader with support for Linux, Multiboot and more"
url="https://www.gnu.org/software/grub/"
arch="all !s390x"
@@ -12,6 +12,8 @@ license="GPL-3.0+"
depends=""
makedepends="bison flex freetype-dev linux-headers lvm2-dev python3 xz unifont
automake autoconf libtool"
+# [22:02] <@awilfox> [[sroracle]]: grub breaks without its locale files present
+# [22:02] <@awilfox> it cannot be split
subpackages="$pkgname-dev $pkgname-doc"
# currently grub only builds on x86*, aarch64 and ppc* systems
@@ -27,6 +29,9 @@ for f in $flavors; do
subpackages="$subpackages $pkgname-$f"
done
+install="$pkgname.post-upgrade"
+triggers="$pkgname.trigger=/boot"
+
source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
fix-gcc-no-pie-specs.patch
grub2-accept-empty-module.patch
@@ -34,6 +39,7 @@ source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
the-arch-everyone-uses-and-nobody-loves.patch
x86_64_asm.patch
default-grub
+ update-grub
"
prepare() {
@@ -119,6 +125,7 @@ package() {
rm -f "$pkgdir"/usr/lib/charset.alias
install -D -m644 "$srcdir"/default-grub "$pkgdir"/etc/default/grub
+ install -D -m755 "$srcdir"/update-grub "$pkgdir"/usr/sbin
# remove grub-install warning of missing directory
mkdir -p "$pkgdir"/usr/share/locale
}
@@ -163,4 +170,5 @@ f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
088455205f2f397d60e43eab19ed73994880ea1f442661f7975846cceaf2b112d92fd1341119d7dbfad3af2174dfd4d4721f31dead1ac35f4a3cb7c0d92f8a04 the-arch-everyone-uses-and-nobody-loves.patch
8752b5e689ec3b7e1f438c7207adc517d7acb4f7d15fda2907bc9177883a686f23994c66641bfc0c7620365415972b5d8b74f511c13dd234f5f3461dda4bb445 x86_64_asm.patch
-048d061ac0aab0106f59a3d257739ff5de6c7dc08a4dc9b8b12e9bd2b1ec11f9bc6214013f3d1083b11c3ce41185fcbb5615beb2f290380abf392bb4c3f0d509 default-grub"
+af771faa02dcc56a0842c6b5244030d0778c80c365c6cafa7ed255346fb2d67e7e95cbb7bcdabe75c96d73ee8a1c9dd6f30e2feac708e621a64fee858b09db51 default-grub
+f08e29cb8bc344d62e37ffe003a74c1316c19aa329a4c2af94c99bfc90cb2968a37811244a7617cf1f1c393119f6398200d094b7758c19583cca390630c106ec update-grub"
diff --git a/user/grub/default-grub b/user/grub/default-grub
index 18fc2317d..e97e38395 100644
--- a/user/grub/default-grub
+++ b/user/grub/default-grub
@@ -6,3 +6,7 @@ GRUB_DEFAULT="Adélie"
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Adélie"
GRUB_CMDLINE_LINUX_DEFAULT="ro"
+
+# 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
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
diff --git a/user/grub/grub.trigger b/user/grub/grub.trigger
new file mode 100644
index 000000000..eba13a458
--- /dev/null
+++ b/user/grub/grub.trigger
@@ -0,0 +1,2 @@
+#!/bin/sh -e
+exec update-grub
diff --git a/user/grub/update-grub b/user/grub/update-grub
new file mode 100644
index 000000000..c8c495390
--- /dev/null
+++ b/user/grub/update-grub
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+. /etc/default/grub
+if [ "$ADELIE_MANUAL_CONFIG" -eq 1 ]; then
+ cat >&2 <<-EOF
+ *
+ * You have specified that you are using a manual GRUB configuration.
+ * You must update it yourself.
+ *
+ EOF
+ exit 0
+fi
+
+cp -p /boot/grub/grub.cfg /boot/grub/grub.cfg.update-grub-old
+exec grub-mkconfig -o /boot/grub/grub.cfg