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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 vapier 1.12 # Copyright 1999-2006 Gentoo Foundation
2 vapier 1.5 # Distributed under the terms of the GNU General Public License v2
3 vapier 1.12 # $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 vapier 1.8 #
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 vapier 1.12 #
11     # MAINTAINER: base-system@gentoo.org
12 woodchip 1.1
13 woodchip 1.7 EXPORT_FUNCTIONS pkg_preinst
14 woodchip 1.1
15 woodchip 1.7 mount-boot_mount_boot_partition(){
16     # note that /dev/BOOT is in the Gentoo default /etc/fstab file
17 woodchip 1.6 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 woodchip 1.3 local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
20 woodchip 1.1
21     if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
22 woodchip 1.3 if [ -n "${proc_ro}" ]; then
23 woodchip 1.7 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 woodchip 1.1 mount -o remount,rw /boot &>/dev/null
28     if [ "$?" -ne 0 ]; then
29 woodchip 1.7 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 woodchip 1.1 fi
34     else
35 woodchip 1.7 einfo
36 woodchip 1.1 einfo "Your boot partition was detected as being mounted as /boot."
37     einfo "Files will be installed there for ${PN} to function correctly."
38 woodchip 1.7 einfo
39 woodchip 1.1 fi
40     elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
41 woodchip 1.3 mount /boot -o rw &>/dev/null
42 woodchip 1.1 if [ "$?" -eq 0 ]; then
43 woodchip 1.7 einfo
44 woodchip 1.3 einfo "Your boot partition was not mounted as /boot, but portage"
45     einfo "was able to mount it without additional intervention."
46 woodchip 1.1 einfo "Files will be installed there for ${PN} to function correctly."
47 woodchip 1.7 einfo
48 woodchip 1.1 else
49 woodchip 1.7 eerror
50     eerror "Cannot automatically mount your /boot partition."
51     eerror "Your boot partition has to be mounted rw before the installation"
52 woodchip 1.1 eerror "can continue. ${PN} needs to install important files there."
53 woodchip 1.7 eerror
54     die "Please mount your /boot partition manually!"
55 woodchip 1.1 fi
56     else
57 woodchip 1.7 einfo
58 woodchip 1.1 einfo "Assuming you do not have a separate /boot partition."
59 woodchip 1.7 einfo
60 woodchip 1.1 fi
61     }
62    
63 woodchip 1.7 mount-boot_pkg_preinst(){
64     mount-boot_mount_boot_partition
65     }

  ViewVC Help
Powered by ViewVC 1.1.20