diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-09 03:18:38 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-01-09 03:18:38 +0000 |
commit | f77e2e521ec73f0d8aed2e91dbec0be9fe84b446 (patch) | |
tree | 7029fd90c65455ff10967dd3ed43ca86eecbfc7e /eclass | |
parent | warn about relative paths in patches (diff) | |
download | historical-f77e2e521ec73f0d8aed2e91dbec0be9fe84b446.tar.gz historical-f77e2e521ec73f0d8aed2e91dbec0be9fe84b446.tar.bz2 historical-f77e2e521ec73f0d8aed2e91dbec0be9fe84b446.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.eclass | 36 |
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 +} |