summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/mount-boot.eclass')
-rw-r--r--eclass/mount-boot.eclass70
1 files changed, 39 insertions, 31 deletions
diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index e499ddd24057..d6d2f231f41e 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,54 +1,62 @@
-# Copyright 1999-2000 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.1 2002/09/20 18:38:22 woodchip Exp $
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.1.1.1 2005/11/30 09:59:20 chriswhite Exp $
+#
+# If the live system has a separate /boot partition configured, then this
+# function tries to ensure that it's mounted in rw mode, exiting with an
+# error if it cant. It does nothing if /boot isn't a separate partition.
-ECLASS=boot
-INHERITED="$INHERITED $ECLASS"
-boot_pkg_setup(){
+EXPORT_FUNCTIONS pkg_preinst
-[ "${ROOT}" != "/" ] && return 0
-
- local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#/ {print $2}' | egrep "/boot" )"
- local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "/boot" )"
+mount-boot_mount_boot_partition(){
+ # note that /dev/BOOT is in the Gentoo default /etc/fstab file
+ local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#|^\/dev\/BOOT/ {print $2}' | egrep "^/boot$" )"
+ local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "^/boot$" )"
+ local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
- if [ -n "`cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]ro/p }'`" ]; then
- einfo "Your boot partition, detected as being mounted as /boot, is read-only"
- einfo "Remounting it in read-write mode"
- sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
+ if [ -n "${proc_ro}" ]; then
+ einfo
+ einfo "Your boot partition, detected as being mounted as /boot, is read-only."
+ einfo "Remounting it in read-write mode ..."
+ einfo
mount -o remount,rw /boot &>/dev/null
if [ "$?" -ne 0 ]; then
- eerror; eerror "Unable to remount in rw mode. Please do it manually" ; eerror
- sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
- die "Can't remount in rw mode. Please do it manually"
+ eerror
+ eerror "Unable to remount in rw mode. Please do it manually!"
+ eerror
+ die "Can't remount in rw mode. Please do it manually!"
fi
else
- echo
+ einfo
einfo "Your boot partition was detected as being mounted as /boot."
einfo "Files will be installed there for ${PN} to function correctly."
- sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
+ einfo
fi
elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
- mount /boot &>/dev/null
+ mount /boot -o rw &>/dev/null
if [ "$?" -eq 0 ]; then
- echo
- einfo "Your boot partition was not mounted as /boot, but portage was able to mount"
- einfo "it without additional intervention."
+ einfo
+ einfo "Your boot partition was not mounted as /boot, but portage"
+ einfo "was able to mount it without additional intervention."
einfo "Files will be installed there for ${PN} to function correctly."
- sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
+ einfo
else
- echo
- eerror "Your boot partition has to be mounted on /boot before the installation"
+ eerror
+ eerror "Cannot automatically mount your /boot partition."
+ eerror "Your boot partition has to be mounted rw before the installation"
eerror "can continue. ${PN} needs to install important files there."
- sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
- die "Please mount your /boot partition."
+ eerror
+ die "Please mount your /boot partition manually!"
fi
else
- echo
+ einfo
einfo "Assuming you do not have a separate /boot partition."
- sleep 1; echo -ne "\a"; sleep 1; echo -e "\a";
+ einfo
fi
}
-EXPORT_FUNCTIONS pkg_setup
+mount-boot_pkg_preinst(){
+ mount-boot_mount_boot_partition
+}