commit:     63a4f7b64a3686b77d6544ce9c56dfe2f58a9be2
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 21 09:24:01 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Thu Dec 21 09:29:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63a4f7b6

sys-kernel/installkernel-systemd: add 3

adds 10-copy-prebuilt.install. This does exactly the same as
what 50-dracut.install does when it finds an existing image at
the same place as the kernel. However, with the upcoming
USE=generic-uki on gentoo-kernel* we want this behaviour also
when dracut is not installed.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 ...nstallkernel-systemd-3-10-copy-prebuilt.install | 24 +++++++++++++++
 .../installkernel-systemd-3.ebuild                 | 36 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git 
a/sys-kernel/installkernel-systemd/files/installkernel-systemd-3-10-copy-prebuilt.install
 
b/sys-kernel/installkernel-systemd/files/installkernel-systemd-3-10-copy-prebuilt.install
new file mode 100644
index 000000000000..56f4641d9664
--- /dev/null
+++ 
b/sys-kernel/installkernel-systemd/files/installkernel-systemd-3-10-copy-prebuilt.install
@@ -0,0 +1,24 @@
+#!/usr/bin/env sh
+
+# this file is installed by sys-kernel/installkernel-systemd
+
+COMMAND="${1}"
+KERNEL_IMAGE="${4}"
+
+if [ "${COMMAND}" != "add" ]; then
+       exit 0
+fi
+
+IMAGE_DIR="$(dirname ${KERNEL_IMAGE})"
+INITRD=${IMAGE_DIR}/initrd
+UKI=${IMAGE_DIR}/uki.efi
+
+if [ -f "${INITRD}" ]; then
+       echo "Copying prebuilt initramfs to staging area"
+       cp "${INITRD}" "${KERNEL_INSTALL_STAGING_AREA}/initrd" || exit 1
+fi
+
+if [ -f "${UKI}" ]; then
+       echo "Copying prebuilt UKI to staging area"
+       cp "${UKI}" "${KERNEL_INSTALL_STAGING_AREA}/uki.efi" || exit 1
+fi

diff --git a/sys-kernel/installkernel-systemd/installkernel-systemd-3.ebuild 
b/sys-kernel/installkernel-systemd/installkernel-systemd-3.ebuild
new file mode 100644
index 000000000000..f5c22ec7a318
--- /dev/null
+++ b/sys-kernel/installkernel-systemd/installkernel-systemd-3.ebuild
@@ -0,0 +1,36 @@
+# Copyright 2019-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Wrap kernel-install from systemd as installkernel"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage";
+S="${WORKDIR}"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+
+RDEPEND="
+       !sys-kernel/installkernel-gentoo
+       || (
+               sys-apps/systemd[kernel-install(-)]
+               sys-apps/systemd-utils[kernel-install(-)]
+       )
+"
+
+src_install() {
+       # we could technically use a symlink here but it would require
+       # us to know the correct path, and that implies /usr merge problems
+       into /
+       newsbin - installkernel <<-EOF
+               #!/usr/bin/env sh
+               exec kernel-install add "\${1}" "\${2}" --verbose
+       EOF
+
+       exeinto /usr/lib/kernel/install.d/
+       newexe "${FILESDIR}/${PN}-2-r2-00-00machineid-directory.install" \
+               00-00machineid-directory.install
+       newexe "${FILESDIR}/${PN}-3-10-copy-prebuilt.install" \
+               10-copy-prebuilt.install
+}

Reply via email to