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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20