summaryrefslogtreecommitdiff
path: root/eclass/dist-kernel-utils.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-30 08:00:51 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-30 08:00:51 +0100
commitd5ee59790ee8298b8599b0aa0fa21a98b972a44d (patch)
tree2cc4393cdcfae28879cee110e5975f6e6b798f91 /eclass/dist-kernel-utils.eclass
parentd855918b46ba8714cf1320fe63b55fd0ed1748a6 (diff)
gentoo auto-resync : 30:06:2024 - 08:00:50
Diffstat (limited to 'eclass/dist-kernel-utils.eclass')
-rw-r--r--eclass/dist-kernel-utils.eclass39
1 files changed, 33 insertions, 6 deletions
diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index 13137f8c863c..4bc3fab44aae 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -26,7 +26,7 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-inherit toolchain-funcs
+inherit mount-boot-utils toolchain-funcs
# @FUNCTION: dist-kernel_get_image_path
# @DESCRIPTION:
@@ -79,11 +79,38 @@ dist-kernel_install_kernel() {
local image=${2}
local map=${3}
- ebegin "Installing the kernel via installkernel"
- # note: .config is taken relatively to System.map;
- # initrd relatively to bzImage
- ARCH=$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}"
- eend ${?} || die -n "Installing the kernel failed"
+ local success=
+ # not an actual loop but allows error handling with 'break'
+ while true; do
+ nonfatal mount-boot_check_status || break
+
+ ebegin "Installing the kernel via installkernel"
+ # note: .config is taken relatively to System.map;
+ # initrd relatively to bzImage
+ ARCH=$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}" || break
+ eend ${?} || die -n "Installing the kernel failed"
+
+ success=1
+ break
+ done
+
+ if [[ ! ${success} ]]; then
+ # Fallback string, if the identifier file is not found
+ local kernel="<name of your kernel pakcage>:<kernel version>"
+ # Try to read dist-kernel identifier to more accurately instruct users
+ local k_id_file=${image%$(dist-kernel_get_image_path)}/dist-kernel
+ if [[ -f ${k_id_file} ]]; then
+ kernel=\'\=$(<${k_id_file})\'
+ fi
+
+ eerror
+ eerror "The kernel was not deployed successfully. Inspect the failure"
+ eerror "in the logs above and once you resolve the problems please"
+ eerror "run the equivalent of the following command to try again:"
+ eerror
+ eerror " emerge --config ${kernel}"
+ die "Kernel install failed, please fix the problems and run emerge --config"
+ fi
}
# @FUNCTION: dist-kernel_reinstall_initramfs