gentoo-overlay/sys-kernel/hardened-kernel/hardened-kernel-5.4.28.ebuild

67 lines
1.6 KiB
Bash

# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=7
SUFF_VER=".a-hardened"
MY_PV="${PVR}${SUFF_VER}"
inherit rpm kernel-install
DESCRIPTION="Precompiled hardened kernel image with modules"
HOMEPAGE="http://www.gentoo.org/proj/en/hardened/"
SRC_URI="https://localhost/kernel-${MY_PV}.x86_64.rpm
kernel-devel-${MY_PV}.x86_64.rpm"
S=${WORKDIR}
LICENSE="GPL-2"
SLOT="${PVR}"
KEYWORDS="amd64 -*"
IUSE=""
DEPEND=""
RDEPEND=""
QA_PREBUILT='*'
RESTRICT="strip"
src_install() {
mkdir -p "${ED}"/usr/src "${ED}"/lib/modules
mv lib/modules/${MY_PV} "${ED}"/lib/modules/${MY_PV} || die
mv usr/src/${MY_PV} "${ED}"/usr/src/linux-${MY_PV} || die
}
pkg_postinst() {
if [[ -z ${ROOT} ]]; then
mount-boot_pkg_preinst
local image_path=$(kernel-install_get_image_path)
if use initramfs; then
# putting it alongside kernel image as 'initrd' makes
# kernel-install happier
kernel-install_build_initramfs \
"${EROOT}/usr/src/linux-${MY_PV}/${image_path%/*}/initrd" \
"${MY_PV}"
fi
kernel-install_install_kernel "${MY_PV}" \
"${EROOT}/usr/src/linux-${MY_PV}/${image_path}" \
"${EROOT}/usr/src/linux-${MY_PV}/System.map"
fi
kernel-install_update_symlink "${EROOT}/usr/src/linux" "${MY_PV}"
}
pkg_postrm() {
if [[ -z ${ROOT} ]] && use initramfs; then
local image_path=$(kernel-install_get_image_path)
ebegin "Removing initramfs"
rm -f "${EROOT}/usr/src/linux-${MY_PV}/${image_path%/*}/initrd" &&
find "${EROOT}/usr/src/linux-${MY_PV}" -depth -type d -empty -delete
eend ${?}
fi
}