script to find latest stable gentoo kernel version and generate gnu-sources

This commit is contained in:
projectmoon 2021-08-05 19:54:18 +02:00
parent cbf3007b52
commit 8b552d60fb
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,26 @@
EAPI="6"
K_SECURITY_UNSUPPORTED="1"
K_PREDEBLOBBED="1"
ETYPE="sources"
inherit kernel-2
detect_version
DESCRIPTION="Full sources for the Linux Libre kernel"
HOMEPAGE="https://www.fsfla.org/ikiwiki/selibre/linux-libre/"
BASE_URI="http://linux-libre.fsfla.org/pub/linux-libre/releases/${KV_MAJOR}.${KV_MINOR}-gnu/linux-libre-${KV_MAJOR}.${KV_MINOR}-gnu.tar.xz -> linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
PATCH_URI="http://linux-libre.fsfla.org/pub/linux-libre/releases/${PV}-gnu/patch-${KV_MAJOR}.${KV_MINOR}-gnu-${PV}-gnu.xz"
SRC_URI="${BASE_URI} ${PATCH_URI}"
RESTRICT="mirror"
KEYWORDS="~amd64"
UNIPATCH_LIST_DEFAULT=""
UNIPATCH_LIST="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}-gnu-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}-gnu.xz"
pkg_postinst() {
kernel-2_pkg_postinst
einfo "For more info on this patchset, and how to report problems, see:"
einfo "${HOMEPAGE}"
}
pkg_postrm() {
kernel-2_pkg_postrm
}

18
new-kernel-build Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
function get_version {
local arch=$1
local xpath='(//td[contains(@class, "kk-keyword-stable")]//span[contains(., '"$arch"')]/ancestor::tr/td[contains(@class, "kk-version")]//a)[1]/text()'
version=$(curl -s 'https://packages.gentoo.org/packages/sys-kernel/gentoo-sources' | xmllint --nowarning --recover --html --xpath "$xpath" - 2>/dev/null)
echo $version
}
VERSION=$(get_version "amd64")
echo "Current stable gentoo-sources (amd64) is ${VERSION}"
KV_MAJOR=$(echo $VERSION | cut -d'.' -f1)
KV_MINOR=$(echo $VERSION | cut -d'.' -f2)
KV_PATCH=$(echo $VERSION | cut -d'.' -f3)
cp gnu-sources-x.y.z.ebuild.template sys-kernel/gnu-sources/gnu-sources-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.ebuild
echo "Created new ebuild for libre kernel ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"