summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-01-09 03:18:38 +0000
committerMike Frysinger <vapier@gentoo.org>2011-01-09 03:18:38 +0000
commit3dece0e6714642314176fd54610c3183838c0a14 (patch)
tree58006e2c54293a37057a05ac8f63bd906d5e01f8 /eclass
parentwarn about relative paths in patches (diff)
downloadgentoo-2-3dece0e6714642314176fd54610c3183838c0a14.tar.gz
gentoo-2-3dece0e6714642314176fd54610c3183838c0a14.tar.bz2
gentoo-2-3dece0e6714642314176fd54610c3183838c0a14.zip
try to automatically remount/unmount /boot back to its pre-emerge state #348946 by Jaco Kroon
Diffstat (limited to 'eclass')
-rw-r--r--eclass/mount-boot.eclass36
1 files changed, 33 insertions, 3 deletions
diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index fb69e11e4208..c0a6890e5d73 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2008 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.17 2009/10/09 20:57:08 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.18 2011/01/09 03:18:38 vapier Exp $
#
# This eclass is really only useful for bootloaders.
#
@@ -10,7 +10,7 @@
#
# MAINTAINER: base-system@gentoo.org
-EXPORT_FUNCTIONS pkg_preinst pkg_prerm
+EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_prerm pkg_postrm
mount-boot_mount_boot_partition() {
if [[ -n ${DONT_MOUNT_BOOT} ]] ; then
@@ -40,6 +40,7 @@ mount-boot_mount_boot_partition() {
eerror
die "Can't remount in rw mode. Please do it manually!"
fi
+ touch /boot/.e.remount
else
einfo
einfo "Your boot partition was detected as being mounted as /boot."
@@ -62,6 +63,7 @@ mount-boot_mount_boot_partition() {
eerror
die "Please mount your /boot partition manually!"
fi
+ touch /boot/.e.mount
else
einfo
einfo "Assuming you do not have a separate /boot partition."
@@ -78,3 +80,31 @@ mount-boot_pkg_prerm() {
mount-boot_mount_boot_partition
touch "${ROOT}"/boot/.keep 2>/dev/null
}
+
+mount-boot_umount_boot_partition() {
+ if [[ -n ${DONT_MOUNT_BOOT} ]] ; then
+ return
+ fi
+
+ if [ -e /boot/.e.remount ] ; then
+ einfo
+ einfo "Automatically remounting /boot as ro"
+ einfo
+ rm -f /boot/.e.remount
+ mount -o remount,ro /boot
+ elif [ -e /boot/.e.mount ] ; then
+ einfo
+ einfo "Automatically unmounting /boot"
+ einfo
+ rm -f /boot/.e.mount
+ umount /boot
+ fi
+}
+
+mount-boot_pkg_postinst() {
+ mount-boot_umount_boot_partition
+}
+
+mount-boot_pkg_postrm() {
+ mount-boot_umount_boot_partition
+}