Skip to content

Commit

Permalink
Add bcmrpi3-kernel-bis-bin-4.19.56.20190702.ebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
sakaki- committed Jul 2, 2019
1 parent 1901368 commit 807848c
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-kernel/bcmrpi3-kernel-bis-bin/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ DIST bcmrpi3-kernel-bis-bin-4.19.44.20190528.tar.xz 16212968 BLAKE2B 1376e728206
DIST bcmrpi3-kernel-bis-bin-4.19.46.20190604.tar.xz 16206580 BLAKE2B 04fbab5058f700713571f4b1e5d7dacb824d357740e33d5c54f11e301730e4ce5bc00b1f3f5968e9e4448fcf4b1106a21c94f9695344e0393251e273afc48743 SHA512 784ce7d6117354fc386266dbb33d516ec86f36607bdc2ae624b9ebe2160c714706292254033fa30e61a0546a99c1d149f40c2d204d9ce33d55119f48a89a0ac6
DIST bcmrpi3-kernel-bis-bin-4.19.49.20190611.tar.xz 16215124 BLAKE2B 92e05dd577380188f9dc0ff876c92dab68d2a4063a6c60a3e215e2525232bedfb643143ab9595d209d1675f7efc3b8c2d4869c67de472f03ec970797637ec6eb SHA512 e1aef53972b79a386b754fea1e0b0af8c37f6823b24f2b00688f93e7fa7b1785f0816d594866dfbbf80d1c07bd87dde448cb6b9eb24124dc3680cee4a799e2a9
DIST bcmrpi3-kernel-bis-bin-4.19.50.20190618.tar.xz 16208416 BLAKE2B 20dbbfd1ad624444c6009e4d1ccf00f0d247847463939d67818f6d8596465472374af55f1b0471b81a484f9fe6355ce59353ddea80c2916935d70fe6a2c66759 SHA512 367abbcb9fa5bff40d85b6433964d2d0be37757654a389a7934775909477db0a38a94a495b9f74c50bcfc861d670f7915776720ac70711c44c2eae37e0c8543b
DIST bcmrpi3-kernel-bis-bin-4.19.56.20190702.tar.xz 16564068 BLAKE2B 8b4d63efe0153bc656f98b84fb9555f7bf1049ec7cf8dec231744654d5db31305425d1093fb52c86791d69bdbcdf0ad361be6f33d3c2eec7848f87e6d535a2c8 SHA512 020d7b2a2c76cbcdab1c1237d3f6b05850368866e3e6a250f626637f2afd4f7ed4ca1e89eb25bba0a86d1b73758508698f0376ab2fd8ed95334efa297bc7a069
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (c) 2018 sakaki <[email protected]>
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

inherit eutils autotools

DESCRIPTION="Binary RPi3 64-bit kernel package (bcmrpi3_defconfig + tweaks)"
HOMEPAGE="https://github.com/sakaki-/bcmrpi3-kernel-bis"

SRC_URI="${HOMEPAGE}/releases/download/${PV}/bcmrpi3-kernel-bis-${PV}.tar.xz -> ${P}.tar.xz"

LICENSE="GPL-2 freedist"
SLOT="0"
KEYWORDS="~arm64"
IUSE="+checkboot +with-matching-boot-fw pitop"

RESTRICT="mirror"

DEPEND="
!sys-kernel/bcmrpi3-kernel-bin"
RDEPEND="
with-matching-boot-fw? ( ~sys-boot/rpi3-64bit-firmware-1.20190620_p1[pitop(-)?,-dtbo(+)] )
${DEPEND}"

QA_PREBUILT="*"

S="${WORKDIR}"

# ebuild function overrides

pkg_pretend() {
# check /boot directory is mounted, provided $ROOT is /
if use checkboot && [[ "${ROOT%/}" == "" ]]; then
if ! grep -q "^/boot$" <(cut -d " " -f 2 "/proc/mounts") &>/dev/null; then
die "Your /boot directory does not appear to be mounted"
fi
else
ewarn 'Installing into non-default $ROOT'
ewarn "Not checking whether /boot is mounted"
fi
}

src_install() {
local RELEASE_NAME

# just copy tarball contents into temporary install root
insinto /boot
doins -r "${S%/}/boot"/*
insinto /lib/modules
doins -r "${S%/}/lib/modules"/*

# note that we installed the libraries, for future cleanup
RELEASE_NAME=$(head -n1 <(ls -t1d "${S}/lib/modules"/*))
RELEASE_NAME="${RELEASE_NAME##*/}"
echo "${PF}" > "${D%/}/lib/modules/${RELEASE_NAME}/owning_binpkg"
}

pkg_postinst() {
elog "Your new kernel has been installed."
elog "Reboot your system to start using it."
}

pkg_postrm() {
# it is possible that if the kernel originally installed by this ebuild
# is currently running, then its /lib/modules/<release_name> directory
# will still be present, due to some of the module files therein having
# been marked as "in use", leading Portage deline to delete them during
# the default uninstall phase
# detect if this has happened and, if so, forcibly (and recursively)
# delete /lib/modules/<release_name>, and print a warning
local MDIR OWNING_BINPKG

shopt -s nullglob
for MDIR in "${ROOT%/}/lib/modules"/*; do
# was this kernel installed by a binary package?
if [[ -s "${MDIR}/owning_binpkg" ]]; then
OWNING_BINPKG="$(<"${MDIR}/owning_binpkg")"
# was it us? (also check this is not a pure re-install)
if [[ "${PF}" == "${OWNING_BINPKG}" && "${PVR}" != "${REPLACED_BY_VERSION}" ]]; then
# yes, we installed it, we need to remove it
ewarn "Forcibly deleting kernel module directory ${MDIR}"
rm -rf "${MDIR}"
# warn user if this is a 'pure' uninstall,
# rather than an upgrade
if [[ -z "${REPLACED_BY_VERSION}" ]]; then
ewarn "Please ensure you have a valid kernel and module set"
ewarn "in place, before rebooting."
fi
fi
fi
done
shopt -u nullglob
}

0 comments on commit 807848c

Please sign in to comment.