diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-01-13 15:14:06 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-01-16 10:53:06 +0100 |
commit | 5a8858906b9338ab459a7a6640c24695c8abfa2d (patch) | |
tree | 2a1227b6e2239bfccb9d77acc7525a96ad36b5ae /eclass/kernel-install.eclass | |
parent | kernel-install.eclass: Include SLOT in --config suggestion (diff) | |
download | gentoo-5a8858906b9338ab459a7a6640c24695c8abfa2d.tar.gz gentoo-5a8858906b9338ab459a7a6640c24695c8abfa2d.tar.bz2 gentoo-5a8858906b9338ab459a7a6640c24695c8abfa2d.zip |
kernel-install.eclass: Improve failed install error messages
Support and use nonfatal to provide a detailed error message when kernel
postinst fails, in particular the correct 'emerge --config' command.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/kernel-install.eclass')
-rw-r--r-- | eclass/kernel-install.eclass | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index cfd8ec0b7c58..0870999fa5ad 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -343,20 +343,37 @@ kernel-install_install_all() { [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments" local ver=${1} - mount-boot_pkg_preinst - - local image_path=$(dist-kernel_get_image_path) - if use initramfs; then - # putting it alongside kernel image as 'initrd' makes - # kernel-install happier - dist-kernel_build_initramfs \ - "${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \ - "${ver}" - fi + local success= + # not an actual loop but allows error handling with 'break' + while :; do + mount-boot_pkg_preinst + + local image_path=$(dist-kernel_get_image_path) + if use initramfs; then + # putting it alongside kernel image as 'initrd' makes + # kernel-install happier + nonfatal dist-kernel_build_initramfs \ + "${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \ + "${ver}" || break + fi - dist-kernel_install_kernel "${ver}" \ - "${EROOT}/usr/src/linux-${ver}/${image_path}" \ - "${EROOT}/usr/src/linux-${ver}/System.map" + nonfatal dist-kernel_install_kernel "${ver}" \ + "${EROOT}/usr/src/linux-${ver}/${image_path}" \ + "${EROOT}/usr/src/linux-${ver}/System.map" || break + + success=1 + break + done + + if [[ ! ${success} ]]; then + eerror + eerror "The kernel files were copied to disk successfully but the kernel" + eerror "was not deployed successfully. Once you resolve the problems," + eerror "please run the equivalent of the following command to try again:" + eerror + eerror " emerge --config ${CATEGORY}/${PN}:${SLOT}" + die "Kernel install failed, please fix the problems and run emerge --config ${CATEGORY}/${PN}:${SLOT}" + fi } # @FUNCTION: kernel-install_pkg_postinst |