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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Thu Jun 15 14:45:59 2006 UTC (8 years, 2 months ago) by vapier
Branch: MAIN
Changes since 1.11: +6 -3 lines
document maintainers

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

  ViewVC Help
Powered by ViewVC 1.1.20