From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 398C91382C5 for ; Sat, 16 Jan 2021 10:12:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88248E0869; Sat, 16 Jan 2021 10:12:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6F553E0869 for ; Sat, 16 Jan 2021 10:12:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6670D340F8E for ; Sat, 16 Jan 2021 10:12:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 97EB54A6 for ; Sat, 16 Jan 2021 10:11:57 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1610790786.5a8858906b9338ab459a7a6640c24695c8abfa2d.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/dist-kernel-utils.eclass eclass/kernel-install.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 5a8858906b9338ab459a7a6640c24695c8abfa2d X-VCS-Branch: master Date: Sat, 16 Jan 2021 10:11:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2ad4005e-f7b4-43ea-85b6-cfdb47072594 X-Archives-Hash: 8b11d917e9d8102aea271ee48390e226 commit: 5a8858906b9338ab459a7a6640c24695c8abfa2d Author: Michał Górny gentoo org> AuthorDate: Wed Jan 13 14:14:06 2021 +0000 Commit: Michał Górny gentoo org> CommitDate: Sat Jan 16 09:53:06 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a885890 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 gentoo.org> eclass/dist-kernel-utils.eclass | 4 ++-- eclass/kernel-install.eclass | 43 ++++++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index d92642a25a0..d65dc0924b4 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -43,7 +43,7 @@ dist-kernel_build_initramfs() { ebegin "Building initramfs via dracut" dracut --force "${output}" "${version}" - eend ${?} || die "Building initramfs failed" + eend ${?} || die -n "Building initramfs failed" } # @FUNCTION: dist-kernel_get_image_path @@ -89,7 +89,7 @@ dist-kernel_install_kernel() { # note: .config is taken relatively to System.map; # initrd relatively to bzImage installkernel "${version}" "${image}" "${map}" - eend ${?} || die "Installing the kernel failed" + eend ${?} || die -n "Installing the kernel failed" } # @FUNCTION: dist-kernel_reinstall_initramfs diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index cfd8ec0b7c5..0870999fa5a 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