summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorDonny Davies <woodchip@gentoo.org>2003-01-25 01:49:58 +0000
committerDonny Davies <woodchip@gentoo.org>2003-01-25 01:49:58 +0000
commitb11973c7e6f77bb24feaed720057efef14789984 (patch)
treed04d0094ce084df58fde0dd6e9911d01fa245c91 /eclass
parentmark stable x86 (diff)
downloadgentoo-2-b11973c7e6f77bb24feaed720057efef14789984.tar.gz
gentoo-2-b11973c7e6f77bb24feaed720057efef14789984.tar.bz2
gentoo-2-b11973c7e6f77bb24feaed720057efef14789984.zip
move mount /boot to pkg_preinst, remove the bells ;)
Diffstat (limited to 'eclass')
-rw-r--r--eclass/mount-boot.eclass51
1 files changed, 29 insertions, 22 deletions
diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index 5f06424d4a26..c010e32f38bf 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,57 +1,64 @@
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.6 2002/11/13 04:59:31 woodchip Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.7 2003/01/25 01:49:58 woodchip Exp $
ECLASS=mount-boot
INHERITED="$INHERITED $ECLASS"
-mount-boot_pkg_setup(){
+EXPORT_FUNCTIONS pkg_preinst
-[ "${ROOT}" != "/" ] && return 0
+# 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.
+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 "${proc_ro}" ]; then
- echo
- 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 -e "\a"
+ 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 -e "\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 -e "\a"
+ einfo
fi
elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
mount /boot -o rw &>/dev/null
if [ "$?" -eq 0 ]; then
- echo
+ 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 -e "\a"
+ einfo
else
- echo
- eerror "Cannot mount automatically your boot partition."
- 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 -e "\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
+}