depend on mount-boot

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2730 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2010-11-12 19:23:59 +00:00
parent 39905a5dd8
commit 4ff1951c97
1 changed files with 18 additions and 14 deletions

View File

@ -10,6 +10,8 @@
#
# MAINTAINER: base-system@gentoo.org
inherit mount-boot
EXPORT_FUNCTIONS pkg_preinst pkg_prerm
mount-efi_mount_efi_partition() {
@ -17,23 +19,23 @@ mount-efi_mount_efi_partition() {
return
else
elog
elog "To avoid automounting and auto(un)installing with /efi,"
elog "To avoid automounting and auto(un)installing with /boot/efi,"
elog "just export the DONT_MOUNT_EFI variable."
elog
fi
# note that /dev/EFI is in the Gentoo default /etc/fstab file
local fstabstate=$(awk '!/^#|^[[:blank:]]+#|^\/dev\/EFI/ {print $2}' /etc/fstab | egrep "^/efi$" )
local procstate=$(awk '$2 ~ /^\/efi$/ {print $2}' /proc/mounts)
local proc_ro=$(awk '{ print $2 " ," $4 "," }' /proc/mounts | sed -n '/\/efi .*,ro,/p')
local fstabstate=$(awk '!/^#|^[[:blank:]]+#|^\/dev\/EFI/ {print $2}' /etc/fstab | egrep "^/boot/efi$" )
local procstate=$(awk '$2 ~ /^\/boot\/efi$/ {print $2}' /proc/mounts)
local proc_ro=$(awk '{ print $2 " ," $4 "," }' /proc/mounts | sed -n '/\/boot\/efi .*,ro,/p')
if [ -n "${fstabstate}" ] && [ -n "${procstate}" ]; then
if [ -n "${proc_ro}" ]; then
einfo
einfo "Your efi partition, detected as being mounted as /efi, is read-only."
einfo "Your efi partition, detected as being mounted as /boot/efi, is read-only."
einfo "Remounting it in read-write mode ..."
einfo
mount -o remount,rw /efi
mount -o remount,rw /boot/efi
if [ "$?" -ne 0 ]; then
eerror
eerror "Unable to remount in rw mode. Please do it manually!"
@ -42,39 +44,41 @@ mount-efi_mount_efi_partition() {
fi
else
einfo
einfo "Your efi partition was detected as being mounted as /efi."
einfo "Your efi partition was detected as being mounted as /boot/efi."
einfo "Files will be installed there for ${PN} to function correctly."
einfo
fi
elif [ -n "${fstabstate}" ] && [ -z "${procstate}" ]; then
mount /efi -o rw
mount /boot/efi -o rw
if [ "$?" -eq 0 ]; then
einfo
einfo "Your efi partition was not mounted as /efi, but portage"
einfo "Your efi partition was not mounted as /boot/efi, but portage"
einfo "was able to mount it without additional intervention."
einfo "Files will be installed there for ${PN} to function correctly."
einfo
else
eerror
eerror "Cannot automatically mount your /efi partition."
eerror "Cannot automatically mount your /boot/efi partition."
eerror "Your efi partition has to be mounted rw before the installation"
eerror "can continue. ${PN} needs to install important files there."
eerror
die "Please mount your /efi partition manually!"
die "Please mount your /boot/efi partition manually!"
fi
else
einfo
einfo "Assuming you do not have a separate /efi partition."
einfo "Assuming you do not have a separate /boot/efi partition."
einfo
fi
}
mount-efi_pkg_preinst() {
mount-boot_pkg_preinst
mount-efi_mount_efi_partition
}
mount-efi_pkg_prerm() {
touch "${ROOT}"/efi/.keep 2>/dev/null
mount-boot_pkg_prerm
touch "${ROOT}"/boot/efi/.keep 2>/dev/null
mount-efi_mount_efi_partition
touch "${ROOT}"/efi/.keep 2>/dev/null
touch "${ROOT}"/boot/efi/.keep 2>/dev/null
}