[PATCH] mount-boot.eclass: do not create /boot/.keep in pkg_prerm

Mike Gilbert <[email protected]> Wed, 17 Jun 2026 17:11:51 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
systemd-gpt-auto-generator ignores mount points which are not empty
directories. Let's avoid creating a .keep file under /boot every time a
package using this eclass gets unmerged.

Bug: https://bugs.gentoo.org/888807
Signed-off-by: Mike Gilbert <[email protected]>
---
 eclass/mount-boot.eclass | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index ce17026ffd2b..c49fa1f9414f 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: mount-boot.eclass
@@ -33,18 +33,18 @@ mount-boot_pkg_preinst() {
 
 mount-boot_pkg_prerm() {
 	mount-boot_check_status
+	BOOT_EXISTS=
+	[[ -d ${EROOT}/boot ]] && BOOT_EXISTS=1
+}
 
-	if [[ -z ${EPREFIX} ]] \
-		&& ! ( shopt -s failglob; : "${EROOT}"/boot/.keep* ) 2>/dev/null
-	then
-		# Create a .keep file, in case it is shadowed at the mount point
-		touch "${EROOT}"/boot/.keep 2>/dev/null
+mount-boot_pkg_postrm() {
+	if [[ -n ${BOOT_EXISTS} && ! -d ${EROOT}/boot ]]; then
+		# Recreate /boot in case it got un-merged
+		mkdir "${EROOT}"/boot
 	fi
 }
 
 # No-op phases for backwards compatibility
 mount-boot_pkg_postinst() { :; }
 
-mount-boot_pkg_postrm() { :; }
-
 EXPORT_FUNCTIONS pkg_pretend pkg_preinst pkg_postinst pkg_prerm pkg_postrm
-- 
2.54.0