From d5ee59790ee8298b8599b0aa0fa21a98b972a44d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Jun 2024 08:00:51 +0100 Subject: gentoo auto-resync : 30:06:2024 - 08:00:50 --- eclass/dist-kernel-utils.eclass | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'eclass/dist-kernel-utils.eclass') 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=":" + # 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 -- cgit v1.2.3