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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

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

  ViewVC Help
Powered by ViewVC 1.1.20