/[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.17 Revision 1.18
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.17 2009/10/09 20:57:08 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mount-boot.eclass,v 1.18 2011/01/09 03:18:38 vapier Exp $
4# 4#
5# This eclass is really only useful for bootloaders. 5# This eclass is really only useful for bootloaders.
6# 6#
7# If the live system has a separate /boot partition configured, then this 7# If the live system has a separate /boot partition configured, then this
8# function tries to ensure that it's mounted in rw mode, exiting with an 8# function tries to ensure that it's mounted in rw mode, exiting with an
9# error if it cant. It does nothing if /boot isn't a separate partition. 9# error if it cant. It does nothing if /boot isn't a separate partition.
10# 10#
11# MAINTAINER: base-system@gentoo.org 11# MAINTAINER: base-system@gentoo.org
12 12
13EXPORT_FUNCTIONS pkg_preinst pkg_prerm 13EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_prerm pkg_postrm
14 14
15mount-boot_mount_boot_partition() { 15mount-boot_mount_boot_partition() {
16 if [[ -n ${DONT_MOUNT_BOOT} ]] ; then 16 if [[ -n ${DONT_MOUNT_BOOT} ]] ; then
17 return 17 return
18 else 18 else
38 eerror 38 eerror
39 eerror "Unable to remount in rw mode. Please do it manually!" 39 eerror "Unable to remount in rw mode. Please do it manually!"
40 eerror 40 eerror
41 die "Can't remount in rw mode. Please do it manually!" 41 die "Can't remount in rw mode. Please do it manually!"
42 fi 42 fi
43 touch /boot/.e.remount
43 else 44 else
44 einfo 45 einfo
45 einfo "Your boot partition was detected as being mounted as /boot." 46 einfo "Your boot partition was detected as being mounted as /boot."
46 einfo "Files will be installed there for ${PN} to function correctly." 47 einfo "Files will be installed there for ${PN} to function correctly."
47 einfo 48 einfo
60 eerror "Your boot partition has to be mounted rw before the installation" 61 eerror "Your boot partition has to be mounted rw before the installation"
61 eerror "can continue. ${PN} needs to install important files there." 62 eerror "can continue. ${PN} needs to install important files there."
62 eerror 63 eerror
63 die "Please mount your /boot partition manually!" 64 die "Please mount your /boot partition manually!"
64 fi 65 fi
66 touch /boot/.e.mount
65 else 67 else
66 einfo 68 einfo
67 einfo "Assuming you do not have a separate /boot partition." 69 einfo "Assuming you do not have a separate /boot partition."
68 einfo 70 einfo
69 fi 71 fi
76mount-boot_pkg_prerm() { 78mount-boot_pkg_prerm() {
77 touch "${ROOT}"/boot/.keep 2>/dev/null 79 touch "${ROOT}"/boot/.keep 2>/dev/null
78 mount-boot_mount_boot_partition 80 mount-boot_mount_boot_partition
79 touch "${ROOT}"/boot/.keep 2>/dev/null 81 touch "${ROOT}"/boot/.keep 2>/dev/null
80} 82}
83
84mount-boot_umount_boot_partition() {
85 if [[ -n ${DONT_MOUNT_BOOT} ]] ; then
86 return
87 fi
88
89 if [ -e /boot/.e.remount ] ; then
90 einfo
91 einfo "Automatically remounting /boot as ro"
92 einfo
93 rm -f /boot/.e.remount
94 mount -o remount,ro /boot
95 elif [ -e /boot/.e.mount ] ; then
96 einfo
97 einfo "Automatically unmounting /boot"
98 einfo
99 rm -f /boot/.e.mount
100 umount /boot
101 fi
102}
103
104mount-boot_pkg_postinst() {
105 mount-boot_umount_boot_partition
106}
107
108mount-boot_pkg_postrm() {
109 mount-boot_umount_boot_partition
110}

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20