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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Sun Feb 16 04:26:21 2003 UTC (11 years, 6 months ago) by vapier
Branch: MAIN
Branch point for: RELEASE-1_4
Changes since 1.7: +6 -6 lines
header fixes

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

  ViewVC Help
Powered by ViewVC 1.1.20