diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2019-01-24 17:55:24 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-01-24 18:01:30 +0000 |
commit | cb5d66dfdf57d13714e111eda2ef7f9f552d380d (patch) | |
tree | 5217ea85825d6c5a3796b363f81ec7a61898ab9a /main/grub | |
parent | ee1955b85cff0d912c7c3c96d58b807541e48082 (diff) | |
download | aports-cb5d66dfdf57d13714e111eda2ef7f9f552d380d.tar.bz2 aports-cb5d66dfdf57d13714e111eda2ef7f9f552d380d.tar.xz |
main/grub: add post-ugprade to import default config
import boot options to /etc/default/grub on upgrade to make sure we can
still boot.
ref #9903
Diffstat (limited to 'main/grub')
-rw-r--r-- | main/grub/APKBUILD | 12 | ||||
-rw-r--r-- | main/grub/grub.post-upgrade | 19 |
2 files changed, 29 insertions, 2 deletions
diff --git a/main/grub/APKBUILD b/main/grub/APKBUILD index 64cef337e6..3ff3c888f0 100644 --- a/main/grub/APKBUILD +++ b/main/grub/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs <timo.teras@iki.fi> pkgname=grub pkgver=2.02 -pkgrel=12 +pkgrel=13 pkgdesc="Bootloader with support for Linux, Multiboot and more" url="https://www.gnu.org/software/grub/" arch="all !s390x" @@ -12,7 +12,7 @@ triggers="grub.trigger=/boot" depends_dev="" makedepends="$depends_dev bison flex linux-headers xz-dev lvm2-dev automake autoconf libtool python3 freetype-dev unifont" -install="" +install="$pkgname.post-upgrade" # strip handled by grub Makefiles, abuild strip breaks xen pv-grub options="!check !strip" # Cannot test boot loader. subpackages="$pkgname-dev $pkgname-doc" @@ -124,6 +124,14 @@ package() { rm -f "$pkgdir"/usr/lib/charset.alias # remove grub-install warning of missing directory mkdir -p "$pkgdir"/usr/share/locale + + mkdir -p "$pkgdir"/etc/default/ + cat >"$pkgdir"/etc/default/grub <<-EOF + GRUB_DISTRIBUTOR="Alpine" + GRUB_TIMEOUT=2 + GRUB_DISABLE_SUBMENU=y + GRUB_DISABLE_RECOVERY=true + EOF } bios() { diff --git a/main/grub/grub.post-upgrade b/main/grub/grub.post-upgrade new file mode 100644 index 0000000000..2489fc13b6 --- /dev/null +++ b/main/grub/grub.post-upgrade @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -f /etc/grub/default ]; then + . /etc/grub/default +fi + +if [ -z "$GRUB_CMDLINE_LINUX_DEFAULT" ]; then + set -- $(cat /proc/cmdline) + bootopts= + for opt; do + case "$opt" in + initrd=*|BOOT_IMAGE=*|root=*|rootflags=*) ;; + *) bootopts="$bootopts $opt";; + esac + done + mkdir -p /etc/default + echo "GRUB_CMDLINE_LINUX_DEFAULT=\"$bootopts\"" >> /etc/default/grub +fi + |