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

Diff of /eclass/mount-boot.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.3
1# Copyright 1999-2000 Gentoo Technologies, Inc. 1# Copyright 1999-2002 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License, v2 or later 2# Distributed under the terms of the GNU General Public License, v2 or later
3# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.2 2002/09/22 21:02:08 woodchip Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.3 2002/09/30 00:56:44 woodchip Exp $
4 4
5ECLASS=mount-boot 5ECLASS=mount-boot
6INHERITED="$INHERITED $ECLASS" 6INHERITED="$INHERITED $ECLASS"
7 7
8mount-boot_pkg_setup(){ 8mount-boot_pkg_setup(){
9 9
10[ "${ROOT}" != "/" ] && return 0 10[ "${ROOT}" != "/" ] && return 0
11 11
12 local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#/ {print $2}' | egrep "/boot" )" 12 local fstabstate="$(cat /etc/fstab | awk '!/^#|^[[:blank:]]+#/ {print $2}' | egrep "/boot" )"
13 local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "/boot" )" 13 local procstate="$(cat /proc/mounts | awk '{print $2}' | egrep "/boot" )"
14 local proc_ro="$(cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]\?ro[ ,]\?/p }' )"
14 15
15 if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then 16 if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
16 if [ -n "`cat /proc/mounts | awk '{ print $2, $4 }' | sed -n '/\/boot/{ /[ ,]ro/p }'`" ]; then 17 if [ -n "${proc_ro}" ]; then
18 echo
17 einfo "Your boot partition, detected as being mounted as /boot, is read-only" 19 einfo "Your boot partition, detected as being mounted as /boot, is read-only"
18 einfo "Remounting it in read-write mode" 20 einfo "Remounting it in read-write mode"
19 sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a" 21 sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"
20 mount -o remount,rw /boot &>/dev/null 22 mount -o remount,rw /boot &>/dev/null
21 if [ "$?" -ne 0 ]; then 23 if [ "$?" -ne 0 ]; then
22 eerror; eerror "Unable to remount in rw mode. Please do it manually" ; eerror 24 eerror; eerror "Unable to remount in rw mode. Please do it manually" ; eerror
23 sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a" 25 sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"
24 die "Can't remount in rw mode. Please do it manually" 26 die "Can't remount in rw mode. Please do it manually"
25 fi 27 fi
26 else 28 else
27 echo 29 echo
28 einfo "Your boot partition was detected as being mounted as /boot." 30 einfo "Your boot partition was detected as being mounted as /boot."
29 einfo "Files will be installed there for ${PN} to function correctly." 31 einfo "Files will be installed there for ${PN} to function correctly."
30 sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a" 32 sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"
31 fi 33 fi
32 elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then 34 elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
33 mount /boot &>/dev/null 35 mount /boot -o rw &>/dev/null
34 if [ "$?" -eq 0 ]; then 36 if [ "$?" -eq 0 ]; then
35 echo 37 echo
36 einfo "Your boot partition was not mounted as /boot, but portage was able to mount" 38 einfo "Your boot partition was not mounted as /boot, but portage"
37 einfo "it without additional intervention." 39 einfo "was able to mount it without additional intervention."
38 einfo "Files will be installed there for ${PN} to function correctly." 40 einfo "Files will be installed there for ${PN} to function correctly."
39 sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a" 41 sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"
40 else 42 else
41 echo 43 echo
44 eerror "Cannot mount automatically your boot partition."
42 eerror "Your boot partition has to be mounted on /boot before the installation" 45 eerror "Your boot partition has to be mounted on /boot before the installation"
43 eerror "can continue. ${PN} needs to install important files there." 46 eerror "can continue. ${PN} needs to install important files there."
44 sleep 1; echo -ne "\a"; sleep 1; echo -ne "\a" 47 sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"
45 die "Please mount your /boot partition." 48 die "Please mount your /boot partition."
46 fi 49 fi
47 else 50 else
48 echo 51 echo
49 einfo "Assuming you do not have a separate /boot partition." 52 einfo "Assuming you do not have a separate /boot partition."

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20