Created
April 7, 2023 11:49
-
-
Save triffid/77e3d282cc56285408985bd3a1886f47 to your computer and use it in GitHub Desktop.
Gentoo ebuild that depends on running dist-kernel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2021-2023 Gentoo Authors, 2023- Triffid_Hunter | |
# Distributed under the terms of the GNU General Public License v2 | |
EAPI=7 | |
DESCRIPTION="Ebuild to depend on currently running Kernel" | |
HOMEPAGE="" | |
SRC_URI="" | |
LICENSE="" | |
SLOT="0" | |
KEYWORDS="amd64 arm arm64 hppa ppc ppc64 riscv x86" | |
KERN="$(< /proc/sys/kernel/osrelease)" | |
EB_B="${EBUILD%.*}" | |
EB_C="${EB_B%/*}" | |
EBPATH="${EB_C%/*}/${EB_B##*/}" | |
RDEPEND=" | |
|| ( | |
~sys-kernel/gentoo-kernel-${KERN%%-*} | |
~sys-kernel/gentoo-kernel-bin-${KERN%%-*} | |
~sys-kernel/vanilla-kernel-${KERN%%-*} | |
)" | |
src_unpack() { | |
mkdir -p "$S" | |
} | |
src_install() { | |
mkdir -p "${D}/etc/local.d" | |
echo '#!/bin/bash' > "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
echo '' >> "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
echo 'KPACK="=$(find /var/db/pkg -name CONTENTS -exec grep -l /lib/modules/$(uname -r)/kernel {} + | cut -d/ -f5-6)"' >> "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
echo 'echo "$KPACK" > /var/db/pkg/'"${CATEGORY}/${PF}"'/RDEPEND' >> "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
echo "sed -ie 's!^RDEPEND.*!RDEPEND='\"\$KPACK\"'!' /var/cache/edb/dep${EBPATH}" >> "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
chmod +x "${D}/etc/local.d/25-update-current-kernel-dependency.start" | |
default | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment