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

Contents of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sat Jan 25 01:49:58 2003 UTC (12 years, 7 months ago) by woodchip
Branch: MAIN
Changes since 1.6: +29 -22 lines
move mount /boot to pkg_preinst, remove the bells ;)

1 # Copyright 1999-2002 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.6 2002/11/13 04:59:31 woodchip Exp $
4
5 ECLASS=mount-boot
6 INHERITED="$INHERITED $ECLASS"
7
8 EXPORT_FUNCTIONS pkg_preinst
9
10 # If the live system has a separate /boot partition configured, then this
11 # function tries to ensure that it's mounted in rw mode, exiting with an
12 # error if it cant. It does nothing if /boot isn't a separate partition.
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