• [gentoo-dev] [PATCH] kernel-build.eclass: identify dist-kernels, and wa

    From Andrew Nowa Ammerlaan@21:1/5 to All on Wed Jun 26 21:10:01 2024
    Part of https://github.com/gentoo/gentoo/pull/37281

    From c88eee66089333fbcee6377b5f580e70a4ec2a8c Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Mon, 24 Jun 2024 22:18:46 +0200
    Subject: [PATCH] kernel-build.eclass: identify dist-kernels, and warn users

    Many, many, new users at some point make the mistake of running "make ...."
    in the source directory of a distribution kernel.

    This returns a vague error due to the absence of the kernel source files:

    make[2]: *** No rule to make target
    'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop.
    make[1]: *** [arch/x86/Makefile:248: archheaders] Error 2
    make: *** [Makefile:234: __sub-make] Error 2

    Here we append to the kernel Makefile a warning that should make it more
    clear
    what is going wrong. "$(shell [ -t 0 ] && echo 1)" is a trick to show this warning when an user is executing "make" from their shell, but not when
    they are
    compiling out-of-tree kernel modules (which is the reason we need to install these makefiles to begin with).

    We also add a "dist-kernel" file containing the package atom of the
    ebuild that
    installed this kernel. This makes it possible for ebuilds/eclasses or
    whatever
    other tools to check if a kernel is a Gentoo distribution kernel. This identifier will be overwritten in gentoo-kernel-bin.ebuild.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/kernel-build.eclass | 16 ++++++++++++++++
    1 file changed, 16 insertions(+)

    diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
    index 7922638be6e1c..86c7cd4a172d5 100644
    --- a/eclass/kernel-build.eclass
    +++ b/eclass/kernel-build.eclass
    @@ -382,6 +382,22 @@ kernel-build_src_install() {
    local module_ver
    module_ver=$(<"${relfile}") || die

    + # warn when trying to "make" a dist-kernel
    + cat <<-EOF >> "${ED}${kernel_dir}/Makefile" || die
    +
    + _GENTOO_IS_USER_SHELL:=\$(shell [ -t 0 ] && echo 1)
    + ifdef _GENTOO_IS_USER_SHELL
    + \$(warning !!!! WARNING !!!!)
    + \$(warning This kernel was configured and installed by the package
    manager.)
    + \$(warning "make" should not be run manually here.)
    + \$(warning See also: https://wiki.gentoo.org/wiki/Project:Distribution_Kernel)
    + \$(warning See also: https://wiki.gentoo.org/wiki/Kernel/Configuration)
    + \$(warning !!!! WARNING !!!!)
    + endif
    + EOF
    + # add a dist-kernel identifier file
    + echo "${CATEGORY}/${
  • From Andrew Nowa Ammerlaan@21:1/5 to All on Wed Jun 26 22:10:01 2024
    Part of: https://github.com/gentoo/gentoo/pull/37292

    This series builds on the previous patch: "kernel-build.eclass: identify dist-kernels, and warn users"

    Effectively, the change amounts to harmonizing the way ebuilds/eclasses
    using "dist-kernel_reinstall_initramfs" re-install the dist-kernel with
    how kernel-install.eclass installs the dist-kernel. Specifically in the
    area's of a) checking mounting status of /boot and b) handeling failure
    in /sbin/installkernel.

    This addresses an annoying issue new users run into where linux-firmware
    and intel-microcode packages are too strict in enforcing mounted /boot.

    To achieve this:
    - Error handling and mount-boot checking is moved from
    kernel-install.eclass to dist-kerel-utils.eclass
    - In the above we run into the problem that mount-boot.eclass exports pkg_pretend and pkg_{pre,post}{inst,rm}. Whereas dist-kernel-utils
    exports nothing. To resolved the problem the bulk of mount-boot.eclass
    is moved into a new "inherit-safe" mount-boot-utils.eclass, which in
    turn is inherited by mount-boot.eclass for backwards compatibility.
    - The new mount-boot-utils.eclass is adjusted to check not only for
    mounted /boot, but also for a mounted EFI System Partition on UEFI systems.
    - linux-mod-r1.eclass is adjusted to perform the mount-boot check early
    for packages that install modules into the initramfs (currently only
    zfs-kmod). We use pkg_setup instead of the usual pkg_pretend to avoid
    exporting a new phase. The check is nonfatal, i.e. only informative, the
    same way it is when installing the kernel (via kernel-install.eclass)
    - linux-firmware and intel-microcode ebuilds are adjusted to be less
    strict about mounted /boot in the USE=dist-kernel case. This mirrors how
    kernel (re-)installation works in
    kernel-install.eclass/linux-mod-r1.eclass, i.e. nonfatal informative
    warning early, and only hard fail in pkg_postinst with informative
    message on how users can trigger kernel re-installation manually.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Nowa Ammerlaan@21:1/5 to All on Wed Jun 26 22:10:01 2024
    From 53f844361df57d480480b5e0ab0f35d2788ebf6a Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Tue, 25 Jun 2024 15:08:49 +0200
    Subject: [PATCH] mount-boot.eclass: check for ESP as well as /boot, split
    eclass

    This eclass is used by when the dist-kernel has to re-installed.

    Depending on the configuration of sys-kernel/installkernel, the files may be installed to /boot or to the EFI System partition. Therefore, extend
    this eclass
    to check if the ESP is mounted read-write as well on UEFI platforms.

    Split off the main functions into a separate "inherit-safe" eclass so we can safely use it in dist-kernel-utils.eclass and linux-mod-r1.eclass.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/mount-boot-utils.eclass | 109 +++++++++++++++++++++++++++++++++
    eclass/mount-boot.eclass | 81 +++---------------------
    2 files changed, 118 insertions(+), 72 deletions(-)
    create mode 100644 eclass/mount-boot-utils.eclass

    diff --git a/eclass/mount-boot-utils.eclass b/eclass/mount-boot-utils.eclass new file mode 100644
    index 0000000000000..06ea2254b0013
    --- /dev/null
    +++ b/eclass/mount-boot-utils.eclass
    @@ -0,0 +1,109 @@
    +# Copyright 1999-2024 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: mount-boot-utils.eclass
    +# @MAINTAINER:
    +# base-system@gentoo.org
    +# @SUPPORTED_EAPIS: 6 7 8
    +# @BLURB: functions for packages that install files into /boot
    +# @DESCRIPTION:
    +# This eclass is really only useful for bootloaders and kernel
    installation.
    +#
    +# If the live system has a separate /boot partition or ESP configured,
    then this
    +# function tries to ensure that it's mounted in rw mode, exiting with
    an error
    +# if it
  • From Andrew Nowa Ammerlaan@21:1/5 to All on Wed Jun 26 22:10:02 2024
    From c4c5ef732670f8b23f20b1215af49cdceacd28a3 Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Tue, 25 Jun 2024 16:12:39 +0200
    Subject: [PATCH] kernel-install.eclass: move mount-boot check to
    dist-kernel-utils.eclass

    ebuilds and eclasses using dist-kernel_reinstall_initramfs should also
    have the check for mounted /boot and ESP. We can do this safely via mount-boot-utils.eclass which does not export any phases.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/dist-kernel-utils.eclass | 41 +++++++++++++++++++++++++++-----
    eclass/kernel-install.eclass | 42 +++++++--------------------------
    2 files changed, 43 insertions(+), 40 deletions(-)

    diff --git a/eclass/dist-kernel-utils.eclass
    b/eclass/dist-kernel-utils.eclass
    index 13137f8c863c8..b357cfe6d228c 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,40 @@ 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=
  • From Ulrich Mueller@21:1/5 to All on Thu Jun 27 06:10:01 2024
    On Wed, 26 Jun 2024, Andrew Nowa Ammerlaan wrote:

    --- 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,40 @@ 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 :; do

    IMHO "while true" would be better readable.

    + 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
    + # Try to read dist-kernel identifier to more accurately instruct users
    + local kernel
    + local k_id_file=${image%$(dist-kernel_get_image_path)}/dist-kernel
    + if [[ -f ${k_id_file} ]]; then
    + kernel=\'\=$(<${k_id_file})\'
    + else
    + # Fallback string if identifier is not found
    + kernel="<name of your kernel pakcage>:<kernel version>" + 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
    diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index f512d815fe098..a572597bc6fa3 100644
    --- a/eclass/kernel-install.eclass
    +++ b/eclass/kernel-install.eclass
    @@ -18,8 +18,6 @@
    # location and System.map.
    #
    # The eclass exports src_test, pkg_postinst and pkg_postrm.
    -# Additionally, the inherited mount-boot eclass exports pkg_pretend.
    -# It also stubs out pkg_preinst and pkg_prerm defined by mount-boot.

    # @ECLASS_VARIABLE: KERNEL_IUSE_GENERIC_UKI
    # @PRE_INHERIT
    @@ -50,7 +48,7 @@ case ${EAPI} in
    *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    esac

    -inherit dist-kernel-utils mount-boot multiprocessing toolchain-funcs +inherit dist-kernel-utils mount-boot-utils multiprocessing toolchain-funcs

    SLOT="${PV}"
    IUSE="+initramfs test"
    @@ -526,6 +524,10 @@ kernel-install_test() {
    kernel-install_pkg_pretend() {
    debug-print-function ${FUNCNAME} "${@}"

    + # Check, but don't die because we can fix the problem and then
    + # emerge --config ... to re-run installation.
    + nonfatal mount-boot_check_status
    +
    if ! has_version -d sys-kernel/linux-firmware; then
    ewarn "sys-kernel/linux-firmware not found installed on your system."
    ewarn "This package provides various firmware files that may be needed"
    @@ -665,27 +667,8 @@ kernel-install_install_all() {
    fi
    fi

    - local success=
    - # not an actual loop but allows error handling with 'break'
    - while :; do
    - nonfatal mount-boot_check_status || break
    -
    - nonfatal dist-kernel_install_kernel "${module_ver}" \
    - "${kernel_dir}/${image_path}" "${kernel_dir}/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
    + dist-kernel_install_kernel "${module_ver}" "${kernel_dir}/${image_path}" \
    + "${kernel_dir}/System.map"
    }

    # @FUNCTION: kernel-install_pkg_postinst
    @@ -718,15 +701,6 @@ kernel-install_pkg_postinst() {
    fi
    }

    -# @FUNCTION: kernel-install_pkg_prerm
    -# @DESCRIPTION:
    -# Stub out mount-boot.eclass.
    -kernel-install_pkg_prerm() {
    - debug-print-function ${FUNCNAME} "${@}"
    -
    - # (no-op)
    -}
    -
    # @FUNCTION: kernel-install_pkg_postrm
    # @DESCRIPTION:
    # Clean up the generated initramfs from the removed kernel directory.
    @@ -774,5 +748,5 @@ kernel-install_compress_modules() {

    fi

    -EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm +EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_postrm
    EXPORT_FUNCTIONS pkg_config pkg_pretend

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmZ85ZAPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4ukXsH/ip3DGPTMQ0wlB2+u981qGiKg6unA2TJjll7 4qOMFA1/mDBaBW1zgYUAFO8v1Cf0KUWQd4L3APDquLSY9TQRcpoWuCBmYeN4074S Q3S9C4ufNpPQ9+Kr8j48sQFe2O1k391zjy45vtBr2mHEcLQvWVZ/S8VN1NH6e06B g5lC0i39No6hloqFQGIRAdZPYj2m4XAx7gRjAFyXYQx8kfS10pXQxpxAtLFV+0w3 7ZsEeAErHcRw19L+SJSrRI56mkSQNtrEpxROQRoqGK2xg5Sd4nnb4yruGDXeuLmd rj+h9aylW9kE2Q32g4bU9VarQscCWjaVJs2D8RtLKDXkjWDkPQo=CzcB
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulrich Mueller@21:1/5 to All on Thu Jun 27 06:10:01 2024
    On Wed, 26 Jun 2024, Andrew Nowa Ammerlaan wrote:

    +# @SUPPORTED_EAPIS: 6 7 8

    AFAICS, no EAPI 6 ebuild inherits mount-boot, so EAPI 6 could be
    dropped?

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmZ84/cPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4uVg4H/01f9zGfG5Nftdnlnmv0icgxN/kAZkxgg2Bp fu11cXrmuk4TT16U5iviMOJ93NS0iH0ZwfvV7Z6wQjC2Zayh0wNtA9cfruO3PDd4 H6L76bnCACovHmuKhsHdGiP7MfLMR+ifpzsJlVNi+2JqNiX8yS/mjoJRrD4DY0+D Vt7fI8DqD5iWku4Tj+e3eypzONdTQeluOH2EKwj2ykdtilMB0Mm0tptxAE2pFbAl ocPZu2A5+ZNgZLg+Kn7esjLdlBSbBAmh/97+1Vvi0lrap6Sl1l1Z8tghKkkLKNVF vnwWmTR5iu197SLidks+0warE89OtWN9toBx2sIPlO7uQ6HRTxA=
    =AOVG
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Nowa Ammerlaan@21:1/5 to Ulrich Mueller on Thu Jun 27 16:30:02 2024
    On 27/06/2024 06:07, Ulrich Mueller wrote:
    IMHO "while true" would be better readable.

    Adjusted, here's v2:

    From 422fcc5fb53c3f2adf25256fb7d18a65e4036496 Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Tue, 25 Jun 2024 16:12:39 +0200
    Subject: [PATCH] kernel-install.eclass: move mount-boot check to
    dist-kernel-utils.eclass

    ebuilds and eclasses using dist-kernel_reinstall_initramfs should also
    have the check for mounted /boot and ESP. We can do this safely via mount-boot-utils.eclass which does not export any phases.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/dist-kernel-utils.eclass | 39 ++++++++++++++++++++++++-----
    eclass/kernel-install.eclass | 44 +++++++--------------------------
    2 files changed, 42 insertions(+), 41 deletions(-)

    diff --git a/eclass/dist-kernel-utils.eclass
    b/eclass/dist-kernel-utils.eclass
    index 13137f8c863c8..4bc3fab44aae9 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=
    + #
  • From Andrew Nowa Ammerlaan@21:1/5 to Ulrich Mueller on Thu Jun 27 16:30:02 2024
    On 27/06/2024 06:00, Ulrich Mueller wrote:
    AFAICS, no EAPI 6 ebuild inherits mount-boot, so EAPI 6 could be
    dropped?

    Yes, might as well drop that now. Here's v2:

    From 9f6e912237bf1f67b3bb5341e64449a6b02703bc Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Tue, 25 Jun 2024 15:08:49 +0200
    Subject: [PATCH] mount-boot.eclass: check for ESP as well as /boot, split
    eclass

    This eclass is used by when the dist-kernel has to re-installed.

    Depending on the configuration of sys-kernel/installkernel, the files may be installed to /boot or to the EFI System partition. Therefore, extend
    this eclass
    to check if the ESP is mounted read-write as well on UEFI platforms.

    Split off the main functions into a separate "inherit-safe" eclass so we can safely use it in dist-kernel-utils.eclass and linux-mod-r1.eclass.

    In the process we drop support for EAPI 6, since there are no EAPI 6
    consumers
    left in ::gentoo.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/mount-boot-utils.eclass | 109 +++++++++++++++++++++++++++++++++
    eclass/mount-boot.eclass | 85 ++++---------------------
    2 files changed, 120 insertions(+), 74 deletions(-)
    create mode 100644 eclass/mount-boot-utils.eclass

    diff --git a/eclass/mount-boot-utils.eclass b/eclass/mount-boot-utils.eclass new file mode 100644
    index 0000000000000..600b60a20d89d
    --- /dev/null
    +++ b/eclass/mount-boot-utils.eclass
    @@ -0,0 +1,109 @@
    +# Copyright 1999-2024 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: mount-boot-utils.eclass
    +# @MAINTAINER:
    +# base-system@gentoo.org
    +# @SUPPORTED_EAPIS: 6 7 8
    +# @BLURB: functions for packages that install files into /boot or the ESP
    +# @DESCRIPTION:
    +# This eclass is really only useful for bootloaders and kernel
    installation.
    +#
    +# If the live system has a separate /boot partition or ESP configured,
    then this
    +# function tries to ensure that it's mounted in rw mode, exiting with
    an erro
  • From Ulrich Mueller@21:1/5 to All on Fri Jun 28 08:40:01 2024
    On Thu, 27 Jun 2024, Andrew Nowa Ammerlaan wrote:

    On 27/06/2024 06:00, Ulrich Mueller wrote:
    AFAICS, no EAPI 6 ebuild inherits mount-boot, so EAPI 6 could be
    dropped?

    Yes, might as well drop that now. Here's v2:

    +# @FUNCTION: mount-boot_is_disabled
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Detect whether the current environment/build settings are such that
    we do not
    +# want to mess with any mounts.
    +mount-boot_is_disabled() {
    + # Since this eclass only deals with /boot, skip things when
    EROOT is active.
    + if [[ ${EROOT:-/} != / ]] ; then

    This could be simplified to [[ -n ${EROOT} ]], because EROOT is
    guaranteed not to end in a slash in EAPI 7 and later.

    (Sorry, I had missed this one in v1.)

    + return 0
    + fi
    +
    + # If we're only building a package, then there's no need to check things.
    + if [[ ${MERGE_TYPE} == buildonly ]] ; then
    + return 0
    + fi
    +
    + # The user wants us to leave things be.
    + if [[ -n ${DONT_MOUNT_BOOT} ]] ; then
    + return 0
    + fi
    +
    + # OK, we want to handle things ourselves.
    + return 1
    +}

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmZ+WR4PHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4uWugIAJeRzPKrZvphp3fnAYn7v0jV1ZP5bOlbPctF 9+SRbbbtQ/m4FgTQ0qasZaoc/LERDxpUnjruaDcpzpHk1L4aOjH7Bzq3iRrISoSR Qw81gnUC7pn/tOlJL4s09nno/ZAFHJAjSodgcVJA4zRdN/g8nDvishXhtfsiLtmH UqdKyr4QIN4COuIUEejJftqrddoK3HPrdCmuwvW8yDO8QKrYPzOMRxhK/VHDArWm zQrDAGAG0ZIq0WVvlOse/lUrYWSFu7xZDR38lhP4wpaN3HwJof7CV8U+qphpH2kS 9aKfecGaI9vhWxF/e2d+TkMAODnwxP2f/1F2/PmTizK+9sh3fHw=
    =25RC
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Nowa Ammerlaan@21:1/5 to Ulrich Mueller on Fri Jun 28 11:20:01 2024
    On 28/06/2024 08:33, Ulrich Mueller wrote:
    On Thu, 27 Jun 2024, Andrew Nowa Ammerlaan wrote:

    On 27/06/2024 06:00, Ulrich Mueller wrote:
    AFAICS, no EAPI 6 ebuild inherits mount-boot, so EAPI 6 could be
    dropped?

    Yes, might as well drop that now. Here's v2:

    This could be simplified to [[ -n ${EROOT} ]], because EROOT is
    guaranteed not to end in a slash in EAPI 7 and later.

    (Sorry, I had missed this one in v1.)


    Fixed! And also made the use of "]] ; then" versus "]]; then" consistent
    here.

    From bcbffbe3c691156e5e7d64dedf42fb5eb4dd02d0 Mon Sep 17 00:00:00 2001
    From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    Date: Tue, 25 Jun 2024 15:08:49 +0200
    Subject: [PATCH] mount-boot.eclass: check for ESP as well as /boot, split
    eclass

    This eclass is used by when the dist-kernel has to re-installed.

    Depending on the configuration of sys-kernel/installkernel, the files may be installed to /boot or to the EFI System partition. Therefore, extend
    this eclass
    to check if the ESP is mounted read-write as well on UEFI platforms.

    Split off the main functions into a separate "inherit-safe" eclass so we can safely use it in dist-kernel-utils.eclass and linux-mod-r1.eclass.

    In the process we drop support for EAPI 6, since there are no EAPI 6
    consumers
    left in ::gentoo.

    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/mount-boot-utils.eclass | 109 +++++++++++++++++++++++++++++++++
    eclass/mount-boot.eclass | 85 ++++---------------------
    2 files changed, 120 insertions(+), 74 deletions(-)
    create mode 100644 eclass/mount-boot-utils.eclass

    diff --git a/eclass/mount-boot-utils.eclass b/eclass/mount-boot-utils.eclass new file mode 100644
    index 0000000000000..39f8e94b84ec7
    --- /dev/null
    +++ b/eclass/mount-boot-utils.eclass
    @@ -0,0 +1,109 @@
    +# Copyright 1999-2024 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: mount-boot-utils.eclass
    +# @MAINTAINER:
    +# base-system@gentoo.org
    +# @SUPPORTED_EAPIS: 6 7 8
    +# @BLURB: functions for packages that install files into /boot or the ESP
    +# @DESCRIPTION:
    +# This eclass is really only useful for bootloaders and kernel
    installation.
    +#
    +# If the live system has a separate /boot partition or ESP configured,
    then this
    +# function tries to ensure that it's mounted in rw mode, exiting with
    an erro