/[gentoo-x86]/eclass/mount-boot.eclass
Gentoo

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Wed Jul 6 20:20:04 2005 UTC (9 years, 4 months ago) by agriffis
Branch: MAIN
Changes since 1.9: +1 -2 lines
Remove ECLASS= and INHERITED= which haven't been necessary for a long time now

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.9 2004/06/25 00:39:48 vapier Exp $
4 #
5 # If the live system has a separate /boot partition configured, then this
6 # function tries to ensure that it's mounted in rw mode, exiting with an
7 # error if it cant. It does nothing if /boot isn't a separate partition.
8
9 INHERITED="$INHERITED $ECLASS"
10
11 EXPORT_FUNCTIONS pkg_preinst
12
13 mount-boot_mount_boot_partition(){
14 # note that /dev/BOOT is in the Gentoo default /etc/fstab file
15 local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#|^\/dev\/BOOT/ {print $2}' | egrep "^/boot$" )"
16 local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "^/boot$" )"
17 local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
18
19 if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
20 if [ -n "${proc_ro}" ]; then
21 einfo
22 einfo "Your boot partition, detected as being mounted as /boot, is read-only."
23 einfo "Remounting it in read-write mode ..."
24 einfo
25 mount -o remount,rw /boot &>/dev/null
26 if [ "$?" -ne 0 ]; then
27 eerror
28 eerror "Unable to remount in rw mode. Please do it manually!"
29 eerror
30 die "Can't remount in rw mode. Please do it manually!"
31 fi
32 else
33 einfo
34 einfo "Your boot partition was detected as being mounted as /boot."
35 einfo "Files will be installed there for ${PN} to function correctly."
36 einfo
37 fi
38 elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
39 mount /boot -o rw &>/dev/null
40 if [ "$?" -eq 0 ]; then
41 einfo
42 einfo "Your boot partition was not mounted as /boot, but portage"
43 einfo "was able to mount it without additional intervention."
44 einfo "Files will be installed there for ${PN} to function correctly."
45 einfo
46 else
47 eerror
48 eerror "Cannot automatically mount your /boot partition."
49 eerror "Your boot partition has to be mounted rw before the installation"
50 eerror "can continue. ${PN} needs to install important files there."
51 eerror
52 die "Please mount your /boot partition manually!"
53 fi
54 else
55 einfo
56 einfo "Assuming you do not have a separate /boot partition."
57 einfo
58 fi
59 }
60
61 mount-boot_pkg_preinst(){
62 mount-boot_mount_boot_partition
63 }

  ViewVC Help
Powered by ViewVC 1.1.20