projectmoon-overlay/new-kernel-build

19 lines
800 B
Bash
Executable File

#!/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}"