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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Wed Jul 6 20:23:20 2005 UTC (9 years, 2 months ago) by agriffis
Branch: MAIN
Changes since 1.10: +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.10 2005/07/06 20:20:04 agriffis 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
10 EXPORT_FUNCTIONS pkg_preinst
11
12 mount-boot_mount_boot_partition(){
13 # note that /dev/BOOT is in the Gentoo default /etc/fstab file
14 local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#|^\/dev\/BOOT/ {print $2}' | egrep "^/boot$" )"
15 local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "^/boot$" )"
16 local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
17
18 if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
19 if [ -n "${proc_ro}" ]; then
20 einfo
21 einfo "Your boot partition, detected as being mounted as /boot, is read-only."
22 einfo "Remounting it in read-write mode ..."
23 einfo
24 mount -o remount,rw /boot &>/dev/null
25 if [ "$?" -ne 0 ]; then
26 eerror
27 eerror "Unable to remount in rw mode. Please do it manually!"
28 eerror
29 die "Can't remount in rw mode. Please do it manually!"
30 fi
31 else
32 einfo
33 einfo "Your boot partition was detected as being mounted as /boot."
34 einfo "Files will be installed there for ${PN} to function correctly."
35 einfo
36 fi
37 elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
38 mount /boot -o rw &>/dev/null
39 if [ "$?" -eq 0 ]; then
40 einfo
41 einfo "Your boot partition was not mounted as /boot, but portage"
42 einfo "was able to mount it without additional intervention."
43 einfo "Files will be installed there for ${PN} to function correctly."
44 einfo
45 else
46 eerror
47 eerror "Cannot automatically mount your /boot partition."
48 eerror "Your boot partition has to be mounted rw before the installation"
49 eerror "can continue. ${PN} needs to install important files there."
50 eerror
51 die "Please mount your /boot partition manually!"
52 fi
53 else
54 einfo
55 einfo "Assuming you do not have a separate /boot partition."
56 einfo
57 fi
58 }
59
60 mount-boot_pkg_preinst(){
61 mount-boot_mount_boot_partition
62 }

  ViewVC Help
Powered by ViewVC 1.1.20