summaryrefslogtreecommitdiff
path: root/eclass/mount-boot.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-22 20:28:19 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-22 20:28:19 +0000
commitabaa75b10f899ada8dd05b23cc03205064394bc6 (patch)
treeeca3dd248b73b92013cba00a0fcc1edf2696e19a /eclass/mount-boot.eclass
parent24fd814c326e282c4321965c31f341dad77e270d (diff)
gentoo resync : 22.01.2021
Diffstat (limited to 'eclass/mount-boot.eclass')
-rw-r--r--eclass/mount-boot.eclass19
1 files changed, 12 insertions, 7 deletions
diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index 00b367793252..2b07160231a6 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -1,9 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: mount-boot.eclass
# @MAINTAINER:
# base-system@gentoo.org
+# @SUPPORTED_EAPIS: 6 7
# @BLURB: functions for packages that install files into /boot
# @DESCRIPTION:
# This eclass is really only useful for bootloaders.
@@ -13,7 +14,7 @@
# error if it can't. It does nothing if /boot isn't a separate partition.
case ${EAPI:-0} in
- 4|5|6|7) ;;
+ 6|7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -48,10 +49,11 @@ mount-boot_is_disabled() {
# @INTERNAL
# @DESCRIPTION:
# Check if /boot is sane, i.e., mounted as read-write if on a separate
-# partition. Die if conditions are not fulfilled.
+# partition. Die if conditions are not fulfilled. If nonfatal is used,
+# the function will return a non-zero status instead.
mount-boot_check_status() {
# Get out fast if possible.
- mount-boot_is_disabled && return
+ mount-boot_is_disabled && return 0
# note that /dev/BOOT is in the Gentoo default /etc/fstab file
local fstabstate=$(awk '!/^[[:blank:]]*#|^\/dev\/BOOT/ && $2 == "/boot" \
@@ -59,7 +61,7 @@ mount-boot_check_status() {
if [[ -z ${fstabstate} ]] ; then
einfo "Assuming you do not have a separate /boot partition."
- return
+ return 0
fi
local procstate=$(awk '$2 == "/boot" { split($4, a, ","); \
@@ -69,18 +71,21 @@ mount-boot_check_status() {
if [[ -z ${procstate} ]] ; then
eerror "Your boot partition is not mounted at /boot."
eerror "Please mount it and retry."
- die "/boot not mounted"
+ die -n "/boot not mounted"
+ return 1
fi
if [[ ${procstate} == ro ]] ; then
eerror "Your boot partition, detected as being mounted at /boot," \
"is read-only."
eerror "Please remount it as read-write and retry."
- die "/boot mounted read-only"
+ die -n "/boot mounted read-only"
+ return 2
fi
einfo "Your boot partition was detected as being mounted at /boot."
einfo "Files will be installed there for ${PN} to function correctly."
+ return 0
}
mount-boot_pkg_pretend() {