| 1 |
woodchip |
1.1 |
# Copyright 1999-2000 Gentoo Technologies, Inc.
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License, v2 or later
|
| 3 |
woodchip |
1.2 |
# $Header: /home/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.1 2002/09/20 18:38:22 woodchip Exp $
|
| 4 |
woodchip |
1.1 |
|
| 5 |
woodchip |
1.2 |
ECLASS=mount-boot
|
| 6 |
woodchip |
1.1 |
INHERITED="$INHERITED $ECLASS"
|
| 7 |
|
|
|
| 8 |
woodchip |
1.2 |
mount-boot_pkg_setup(){
|
| 9 |
woodchip |
1.1 |
|
| 10 |
|
|
[ "${ROOT}" != "/" ] && return 0
|
| 11 |
|
|
|
| 12 |
|
|
local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#/ {print $2}' | egrep "/boot" )"
|
| 13 |
|
|
local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "/boot" )"
|
| 14 |
|
|
|
| 15 |
|
|
if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
|
| 16 |
|
|
if [ -n "`cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]ro/p }'`" ]; then
|
| 17 |
|
|
einfo "Your boot partition, detected as being mounted as /boot, is read-only"
|
| 18 |
|
|
einfo "Remounting it in read-write mode"
|
| 19 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
|
| 20 |
|
|
mount -o remount,rw /boot &>/dev/null
|
| 21 |
|
|
if [ "$?" -ne 0 ]; then
|
| 22 |
|
|
eerror; eerror "Unable to remount in rw mode. Please do it manually" ; eerror
|
| 23 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
|
| 24 |
|
|
die "Can't remount in rw mode. Please do it manually"
|
| 25 |
|
|
fi
|
| 26 |
|
|
else
|
| 27 |
|
|
echo
|
| 28 |
|
|
einfo "Your boot partition was detected as being mounted as /boot."
|
| 29 |
|
|
einfo "Files will be installed there for ${PN} to function correctly."
|
| 30 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
|
| 31 |
|
|
fi
|
| 32 |
|
|
elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
|
| 33 |
|
|
mount /boot &>/dev/null
|
| 34 |
|
|
if [ "$?" -eq 0 ]; then
|
| 35 |
|
|
echo
|
| 36 |
|
|
einfo "Your boot partition was not mounted as /boot, but portage was able to mount"
|
| 37 |
|
|
einfo "it without additional intervention."
|
| 38 |
|
|
einfo "Files will be installed there for ${PN} to function correctly."
|
| 39 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
|
| 40 |
|
|
else
|
| 41 |
|
|
echo
|
| 42 |
|
|
eerror "Your boot partition has to be mounted on /boot before the installation"
|
| 43 |
|
|
eerror "can continue. ${PN} needs to install important files there."
|
| 44 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a"
|
| 45 |
|
|
die "Please mount your /boot partition."
|
| 46 |
|
|
fi
|
| 47 |
|
|
else
|
| 48 |
|
|
echo
|
| 49 |
|
|
einfo "Assuming you do not have a separate /boot partition."
|
| 50 |
|
|
sleep 1; echo -ne "\a"; sleep 1; echo -e "\a";
|
| 51 |
|
|
fi
|
| 52 |
|
|
}
|
| 53 |
|
|
|
| 54 |
|
|
EXPORT_FUNCTIONS pkg_setup
|