commit:     3b3b5360aaa4a2dafc84037f492e73ff31814fd7
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 26 14:56:43 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Sep 26 14:58:44 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b3b5360

sys-boot/grub: add postinst warning to run grub-install

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-boot/grub/grub-2.06-r3.ebuild | 22 ++++++++++++++++------
 sys-boot/grub/grub-9999.ebuild    | 22 ++++++++++++++++------
 2 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/sys-boot/grub/grub-2.06-r3.ebuild 
b/sys-boot/grub/grub-2.06-r3.ebuild
index 3331ce3f9b71..341b1edc2a5e 100644
--- a/sys-boot/grub/grub-2.06-r3.ebuild
+++ b/sys-boot/grub/grub-2.06-r3.ebuild
@@ -301,18 +301,28 @@ pkg_postinst() {
        elog "For information on how to configure GRUB2 please refer to the 
guide:"
        elog "    https://wiki.gentoo.org/wiki/GRUB2_Quick_Start";
 
-       if has_version 'sys-boot/grub:0'; then
-               elog "A migration guide for GRUB Legacy users is available:"
-               elog "    https://wiki.gentoo.org/wiki/GRUB2_Migration";
-       fi
-
-       if [[ -z ${REPLACING_VERSIONS} ]]; then
+       if [[ -n ${REPLACING_VERSIONS} ]]; then
+               local v
+               for v in ${REPLACING_VERSIONS}; do
+                       if ver_test -gt ${v}; then
+                               ewarn
+                               ewarn "Re-run grub-install to update installed 
boot code!"
+                               ewarn
+                               break
+                       fi
+               done
+       else
                elog
                optfeature "detecting other operating systems (grub-mkconfig)" 
sys-boot/os-prober
                optfeature "creating rescue media (grub-mkrescue)" 
dev-libs/libisoburn
                optfeature "enabling RAID device detection" sys-fs/mdadm
        fi
 
+       if has_version 'sys-boot/grub:0'; then
+               elog "A migration guide for GRUB Legacy users is available:"
+               elog "    https://wiki.gentoo.org/wiki/GRUB2_Migration";
+       fi
+
        if has_version sys-boot/os-prober; then
                ewarn "Due to security concerns, os-prober is disabled by 
default."
                ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to 
enable it."

diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild
index 5aff4addbbee..407e54b6f361 100644
--- a/sys-boot/grub/grub-9999.ebuild
+++ b/sys-boot/grub/grub-9999.ebuild
@@ -297,18 +297,28 @@ pkg_postinst() {
        elog "For information on how to configure GRUB2 please refer to the 
guide:"
        elog "    https://wiki.gentoo.org/wiki/GRUB2_Quick_Start";
 
-       if has_version 'sys-boot/grub:0'; then
-               elog "A migration guide for GRUB Legacy users is available:"
-               elog "    https://wiki.gentoo.org/wiki/GRUB2_Migration";
-       fi
-
-       if [[ -z ${REPLACING_VERSIONS} ]]; then
+       if [[ -n ${REPLACING_VERSIONS} ]]; then
+               local v
+               for v in ${REPLACING_VERSIONS}; do
+                       if ver_test -gt ${v}; then
+                               ewarn
+                               ewarn "Re-run grub-install to update installed 
boot code!"
+                               ewarn
+                               break
+                       fi
+               done
+       else
                elog
                optfeature "detecting other operating systems (grub-mkconfig)" 
sys-boot/os-prober
                optfeature "creating rescue media (grub-mkrescue)" 
dev-libs/libisoburn
                optfeature "enabling RAID device detection" sys-fs/mdadm
        fi
 
+       if has_version 'sys-boot/grub:0'; then
+               elog "A migration guide for GRUB Legacy users is available:"
+               elog "    https://wiki.gentoo.org/wiki/GRUB2_Migration";
+       fi
+
        if has_version sys-boot/os-prober; then
                ewarn "Due to security concerns, os-prober is disabled by 
default."
                ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to 
enable it."

Reply via email to