summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>2023-12-21 10:24:01 +0100
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2023-12-21 10:29:34 +0100
commit63a4f7b64a3686b77d6544ce9c56dfe2f58a9be2 (patch)
treedfb26436202dd7b1b6ce47eae45f728c7408390b /sys-kernel
parentnet-wireless/bluez: Fix auto-connect with older kernels (diff)
downloadgentoo-63a4f7b64a3686b77d6544ce9c56dfe2f58a9be2.tar.gz
gentoo-63a4f7b64a3686b77d6544ce9c56dfe2f58a9be2.tar.bz2
gentoo-63a4f7b64a3686b77d6544ce9c56dfe2f58a9be2.zip
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@gentoo.org>
Diffstat (limited to 'sys-kernel')
-rw-r--r--sys-kernel/installkernel-systemd/files/installkernel-systemd-3-10-copy-prebuilt.install24
-rw-r--r--sys-kernel/installkernel-systemd/installkernel-systemd-3.ebuild36
2 files changed, 60 insertions, 0 deletions
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
+}