From 8d234aa74d7a6bcf0e025ae47934642155092f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 4 May 2017 00:22:11 +0200 Subject: linux: add sources to package --- sys-kernel/linux/linux-4.10.13.ebuild | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'sys-kernel/linux/linux-4.10.13.ebuild') diff --git a/sys-kernel/linux/linux-4.10.13.ebuild b/sys-kernel/linux/linux-4.10.13.ebuild index b299aa3..f171af7 100644 --- a/sys-kernel/linux/linux-4.10.13.ebuild +++ b/sys-kernel/linux/linux-4.10.13.ebuild @@ -14,7 +14,8 @@ KEYWORDS="amd64 ~x86" IUSE="" DEPEND="" -RDEPEND="${DEPEND}" +RDEPEND="${DEPEND} + sys-boot/myinitramfs" src_configure() { # Fix ARCH variable @@ -29,21 +30,40 @@ src_install() { dodir /boot insinto /boot newins "${S}/arch/$ARCH/boot/bzImage" "bzlinux-${PV}" + + # Package build fragment (kind of annoying because of some packages expecting it) + dodir /usr/src + cp -a "${S}" "${D}/usr/src/linux-${PV}" +} + +# Link /usr/src/linux to newest kernel +src_link() { + ( + cd "${ROOT}/usr/src" + rm -f linux + ln -s $(ls | grep "linux-" | sort | tail -1) linux + ) } pkg_postinst() { # Add label to syslinux config if there is non yet - if ! grep -q "^LABEL gentoo-${PV}$" /boot/syslinux/syslinux.cfg; then - ARGS="$(grep -E "^# ARGS: " /boot/syslinux/syslinux.cfg | sed 's/^# ARGS: //')" + SYSLINUX="${ROOT}/boot/syslinux/syslinux.cfg" + if ! grep -q "^LABEL gentoo-${PV}$" "${SYSLINUX}"; then + ARGS="$(grep -E "^# ARGS: " "${SYSLINUX}" | sed 's/^# ARGS: //')" if [ -n "$ARGS" ]; then - sed -i "/^## Dynamic labels ##$/a LABEL gentoo-${PV}\n\tMENU LABEL Gentoo${PV}\n\tLINUX ../bzlinux-${PV}\n\tAPPEND ${ARGS}\n\tINITRD ../initramfs-gentoo\n" /boot/syslinux/syslinux.cfg || eerror "Adding label to syslinux configuration failed!" + sed -i "/^## Dynamic labels ##$/a LABEL gentoo-${PV}\n\tMENU LABEL Gentoo ${PV}\n\tLINUX ../bzlinux-${PV}\n\tAPPEND ${ARGS}\n\tINITRD ../initramfs-gentoo\n" "${SYSLINUX}" || eerror "Adding label to syslinux configuration failed!" else eerror "Adding label to syslinux configuration failed as there are no arguments" fi fi + src_link } pkg_prerm() { # Remove label from syslinux config sed -i "/^LABEL gentoo-${PV}$/,/^$/d" /boot/syslinux/syslinux.cfg || eerror "Removing label from syslinux fonfiguration failed!" } + +pkg_postrm() { + src_link +} -- cgit v1.2.3