commit:     cfc3e2a9368da66c2275bd0e0f4d88cb392116fd
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 25 14:32:42 2024 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sat Jun 29 08:36:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfc3e2a9

sys-kernel/linux-firmware: complain less when /boot is not mounted

when using dist-kernel we can correct the problem and then
emerge --config ...

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 .../linux-firmware/linux-firmware-20240410.ebuild   | 21 +++++++++++++++------
 .../linux-firmware/linux-firmware-20240513.ebuild   | 21 +++++++++++++++------
 .../linux-firmware-20240610-r1.ebuild               | 21 +++++++++++++++------
 .../linux-firmware/linux-firmware-99999999.ebuild   | 21 +++++++++++++++------
 4 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
index 1bb6954d00c8..b8bbed17f1a6 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
@@ -69,7 +69,15 @@ QA_PREBUILT="*"
 PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
 
 pkg_pretend() {
-       use initramfs && mount-boot_pkg_pretend
+       if use initramfs; then
+               if [[ -z ${ROOT} ]] && use dist-kernel; then
+                       # Check, but don't die because we can fix the problem 
and then
+                       # emerge --config ... to re-run installation.
+                       nonfatal mount-boot_check_status
+               else
+                       mount-boot_pkg_pretend
+               fi
+       fi
 }
 
 pkg_setup() {
@@ -379,7 +387,7 @@ pkg_preinst() {
        fi
 
        # Make sure /boot is available if needed.
-       use initramfs && mount-boot_pkg_preinst
+       use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -397,21 +405,22 @@ pkg_postinst() {
                fi
        done
 
-       # Don't forget to umount /boot if it was previously mounted by us.
        if use initramfs; then
                if [[ -z ${ROOT} ]] && use dist-kernel; then
                        dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+               else
+                       # Don't forget to umount /boot if it was previously 
mounted by us.
+                       mount-boot_pkg_postinst
                fi
-               mount-boot_pkg_postinst
        fi
 }
 
 pkg_prerm() {
        # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
-       use initramfs && mount-boot_pkg_prerm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
 }
 
 pkg_postrm() {
        # Don't forget to umount /boot if it was previously mounted by us.
-       use initramfs && mount-boot_pkg_postrm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
 }

diff --git a/sys-kernel/linux-firmware/linux-firmware-20240513.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-20240513.ebuild
index 1bb6954d00c8..b8bbed17f1a6 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240513.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240513.ebuild
@@ -69,7 +69,15 @@ QA_PREBUILT="*"
 PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
 
 pkg_pretend() {
-       use initramfs && mount-boot_pkg_pretend
+       if use initramfs; then
+               if [[ -z ${ROOT} ]] && use dist-kernel; then
+                       # Check, but don't die because we can fix the problem 
and then
+                       # emerge --config ... to re-run installation.
+                       nonfatal mount-boot_check_status
+               else
+                       mount-boot_pkg_pretend
+               fi
+       fi
 }
 
 pkg_setup() {
@@ -379,7 +387,7 @@ pkg_preinst() {
        fi
 
        # Make sure /boot is available if needed.
-       use initramfs && mount-boot_pkg_preinst
+       use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -397,21 +405,22 @@ pkg_postinst() {
                fi
        done
 
-       # Don't forget to umount /boot if it was previously mounted by us.
        if use initramfs; then
                if [[ -z ${ROOT} ]] && use dist-kernel; then
                        dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+               else
+                       # Don't forget to umount /boot if it was previously 
mounted by us.
+                       mount-boot_pkg_postinst
                fi
-               mount-boot_pkg_postinst
        fi
 }
 
 pkg_prerm() {
        # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
-       use initramfs && mount-boot_pkg_prerm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
 }
 
 pkg_postrm() {
        # Don't forget to umount /boot if it was previously mounted by us.
-       use initramfs && mount-boot_pkg_postrm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
 }

diff --git a/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
index 32bd327957ea..9385d0d0c96e 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
@@ -69,7 +69,15 @@ QA_PREBUILT="*"
 PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
 
 pkg_pretend() {
-       use initramfs && mount-boot_pkg_pretend
+       if use initramfs; then
+               if [[ -z ${ROOT} ]] && use dist-kernel; then
+                       # Check, but don't die because we can fix the problem 
and then
+                       # emerge --config ... to re-run installation.
+                       nonfatal mount-boot_check_status
+               else
+                       mount-boot_pkg_pretend
+               fi
+       fi
 }
 
 pkg_setup() {
@@ -374,7 +382,7 @@ pkg_preinst() {
        fi
 
        # Make sure /boot is available if needed.
-       use initramfs && mount-boot_pkg_preinst
+       use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -392,21 +400,22 @@ pkg_postinst() {
                fi
        done
 
-       # Don't forget to umount /boot if it was previously mounted by us.
        if use initramfs; then
                if [[ -z ${ROOT} ]] && use dist-kernel; then
                        dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+               else
+                       # Don't forget to umount /boot if it was previously 
mounted by us.
+                       mount-boot_pkg_postinst
                fi
-               mount-boot_pkg_postinst
        fi
 }
 
 pkg_prerm() {
        # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
-       use initramfs && mount-boot_pkg_prerm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
 }
 
 pkg_postrm() {
        # Don't forget to umount /boot if it was previously mounted by us.
-       use initramfs && mount-boot_pkg_postrm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
 }

diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index 26c21e80395e..cbf74c22e3a1 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -84,7 +84,15 @@ pkg_setup() {
 }
 
 pkg_pretend() {
-       use initramfs && mount-boot_pkg_pretend
+       if use initramfs; then
+               if [[ -z ${ROOT} ]] && use dist-kernel; then
+                       # Check, but don't die because we can fix the problem 
and then
+                       # emerge --config ... to re-run installation.
+                       nonfatal mount-boot_check_status
+               else
+                       mount-boot_pkg_pretend
+               fi
+       fi
 }
 
 src_unpack() {
@@ -375,7 +383,7 @@ pkg_preinst() {
        fi
 
        # Make sure /boot is available if needed.
-       use initramfs && mount-boot_pkg_preinst
+       use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -393,21 +401,22 @@ pkg_postinst() {
                fi
        done
 
-       # Don't forget to umount /boot if it was previously mounted by us.
        if use initramfs; then
                if [[ -z ${ROOT} ]] && use dist-kernel; then
                        dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+               else
+                       # Don't forget to umount /boot if it was previously 
mounted by us.
+                       mount-boot_pkg_postinst
                fi
-               mount-boot_pkg_postinst
        fi
 }
 
 pkg_prerm() {
        # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
-       use initramfs && mount-boot_pkg_prerm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
 }
 
 pkg_postrm() {
        # Don't forget to umount /boot if it was previously mounted by us.
-       use initramfs && mount-boot_pkg_postrm
+       use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
 }

Reply via email to