main/postmarketos-installkernel: new package (MR 2586)

This script will be used to install postmarketOS mainline kernels.
This commit is contained in:
Alexey Minnekhanov 2021-10-10 01:58:54 +03:00
parent 08bdfccec7
commit a80d0445a7
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,28 @@
# Maintainer: Minecrell <minecrell@minecrell.net>
# Co-Maintainer: Alexey Minnekhanov <alexeymin@postmarketos.org>
# APKBUILD is inspired by Alpine's:
# https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/installkernel
pkgname=postmarketos-installkernel
pkgver=0.1
pkgrel=0
pkgdesc="postmarketOS script for installing mainline kernels"
url="https://gitlab.com/postmarketOS/pmaports/tree/main/postmarketos-installkernel"
arch="noarch"
license="GPL-2.0"
options="!check" # no test suite
provides="installkernel=3.5-r1"
provider_priority=100
replaces="installkernel"
source="installkernel-pmos"
build() {
return 0
}
package() {
install -Dm755 "$srcdir"/installkernel-pmos "$pkgdir"/sbin/installkernel
}
sha512sums="
ba3bdb2d27f7b866a49354fcc4b83ec85747a71265c6b585cb062fc1ff00e88faeba7b77f463d6699e81685c8927ee1d316d5934f374aeebfd4949007d8cb4d8 installkernel-pmos
"

View file

@ -0,0 +1,36 @@
#!/bin/sh
# This script was originally taken from
# https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/installkernel/installkernel
# and modified to suit the postmarketOS requirements for installing kernel binary:
# We don't support flavors - kernel is always installed as "vmlinuz"
set -e
if [ $# -eq 3 ] || [ $# -eq 4 ]; then
kernelversion="$1"
bootimage="$2"
mapfile="$3"
destdir="${4:-/boot}"
else
echo "Usage: installkernel <version> <image> <System.map> <directory>"
exit 1
fi
mapdir=$(dirname "$mapfile")
config="$mapdir"/.config
# backup previous files as ".old"
for i in vmlinuz System.map config; do
if [ -e "$destdir"/$i ]; then
cp "$destdir"/$i "$destdir"/$i.old
fi
done
echo "Installing kernel ${kernelversion} files to ${destdir}"
cp "$bootimage" "$destdir"/vmlinuz
cp "$mapfile" "$destdir"/System.map
cp "$config" "$destdir"/config
exit 0