summaryrefslogtreecommitdiff
path: root/user/grub/grub.post-upgrade
blob: 5b9cbb0727a051f4b2141c6c2133f6bd2a2f1521 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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