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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations) (download)
Wed Jul 6 20:20:04 2005 UTC (9 years, 3 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 vapier 1.9 # Copyright 1999-2004 Gentoo Foundation
2 vapier 1.5 # Distributed under the terms of the GNU General Public License v2
3 agriffis 1.10 # $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.9 2004/06/25 00:39:48 vapier Exp $
4 vapier 1.8 #
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 woodchip 1.1
9     INHERITED="$INHERITED $ECLASS"
10    
11 woodchip 1.7 EXPORT_FUNCTIONS pkg_preinst
12 woodchip 1.1
13 woodchip 1.7 mount-boot_mount_boot_partition(){
14     # note that /dev/BOOT is in the Gentoo default /etc/fstab file
15 woodchip 1.6 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 woodchip 1.3 local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
18 woodchip 1.1
19     if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
20 woodchip 1.3 if [ -n "${proc_ro}" ]; then
21 woodchip 1.7 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 woodchip 1.1 mount -o remount,rw /boot &>/dev/null
26     if [ "$?" -ne 0 ]; then
27 woodchip 1.7 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 woodchip 1.1 fi
32     else
33 woodchip 1.7 einfo
34 woodchip 1.1 einfo "Your boot partition was detected as being mounted as /boot."
35     einfo "Files will be installed there for ${PN} to function correctly."
36 woodchip 1.7 einfo
37 woodchip 1.1 fi
38     elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
39 woodchip 1.3 mount /boot -o rw &>/dev/null
40 woodchip 1.1 if [ "$?" -eq 0 ]; then
41 woodchip 1.7 einfo
42 woodchip 1.3 einfo "Your boot partition was not mounted as /boot, but portage"
43     einfo "was able to mount it without additional intervention."
44 woodchip 1.1 einfo "Files will be installed there for ${PN} to function correctly."
45 woodchip 1.7 einfo
46 woodchip 1.1 else
47 woodchip 1.7 eerror
48     eerror "Cannot automatically mount your /boot partition."
49     eerror "Your boot partition has to be mounted rw before the installation"
50 woodchip 1.1 eerror "can continue. ${PN} needs to install important files there."
51 woodchip 1.7 eerror
52     die "Please mount your /boot partition manually!"
53 woodchip 1.1 fi
54     else
55 woodchip 1.7 einfo
56 woodchip 1.1 einfo "Assuming you do not have a separate /boot partition."
57 woodchip 1.7 einfo
58 woodchip 1.1 fi
59     }
60    
61 woodchip 1.7 mount-boot_pkg_preinst(){
62     mount-boot_mount_boot_partition
63     }

  ViewVC Help
Powered by ViewVC 1.1.20