commit:     ab67f953d2114b604581132459ed7a9e4cbdf4df
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 17:41:05 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 17:42:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab67f953

sys-kernel/linux-firmware: hide mount-boot function calls behind USE flag

This will avoid unnecessary mount/umount of /boot when USE=-initramfs.

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../linux-firmware-20190726-r2.ebuild               | 21 ++++++++++++++++++---
 .../linux-firmware/linux-firmware-99999999.ebuild   | 21 ++++++++++++++++++---
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/sys-kernel/linux-firmware/linux-firmware-20190726-r2.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-20190726-r2.ebuild
index 6e50d29e9c7..0dfd117b3b8 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20190726-r2.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20190726-r2.ebuild
@@ -27,6 +27,7 @@ RESTRICT="binchecks strip
 
 BDEPEND="initramfs? ( app-arch/cpio )"
 
+#add anything else that collides to this
 RDEPEND="!savedconfig? (
                redistributable? (
                        !sys-firmware/alsa-firmware[alsa_cards_ca0132]
@@ -71,7 +72,9 @@ RDEPEND="!savedconfig? (
                )
        )"
 
-#add anything else that collides to this
+pkg_pretend() {
+       use initramfs && mount-boot_pkg_pretend
+}
 
 src_unpack() {
        if [[ ${PV} == 99999999* ]]; then
@@ -317,7 +320,8 @@ pkg_preinst() {
                ewarn "USE=savedconfig is active. You must handle file 
collisions manually."
        fi
 
-       mount-boot_pkg_preinst
+       # Make sure /boot is available if needed.
+       use initramfs && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -335,5 +339,16 @@ pkg_postinst() {
                fi
        done
 
-       mount-boot_pkg_postinst
+       # Don't forget to umount /boot if it was previously mounted by us.
+       use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+       # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+       use initramfs && 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
 }

diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index 6fd9059b3d5..0211e6e23f2 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -27,6 +27,7 @@ RESTRICT="binchecks strip
 
 BDEPEND="initramfs? ( app-arch/cpio )"
 
+#add anything else that collides to this
 RDEPEND="!savedconfig? (
                redistributable? (
                        !sys-firmware/alsa-firmware[alsa_cards_ca0132]
@@ -71,7 +72,9 @@ RDEPEND="!savedconfig? (
                )
        )"
 
-#add anything else that collides to this
+pkg_pretend() {
+       use initramfs && mount-boot_pkg_pretend
+}
 
 src_unpack() {
        if [[ ${PV} == 99999999* ]]; then
@@ -317,7 +320,8 @@ pkg_preinst() {
                ewarn "USE=savedconfig is active. You must handle file 
collisions manually."
        fi
 
-       mount-boot_pkg_preinst
+       # Make sure /boot is available if needed.
+       use initramfs && mount-boot_pkg_preinst
 }
 
 pkg_postinst() {
@@ -335,5 +339,16 @@ pkg_postinst() {
                fi
        done
 
-       mount-boot_pkg_postinst
+       # Don't forget to umount /boot if it was previously mounted by us.
+       use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+       # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+       use initramfs && 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
 }

Reply via email to