summarylogtreecommitdiffstats
path: root/update.sh
blob: 7856af187c25a249f28326c485f7ccbd3b9c54b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

set -eu

cd "$(dirname "$0")"

RELEASES_URL="https://www.kernel.org/releases.json"
SHA256SUMS_URL="https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc"

VERSION="$(curl -sSLf "$RELEASES_URL" |
    jq -r '[.releases[].version] | map(select(startswith("4.4.")))[]')"

HASH="$(curl -sSLf "$SHA256SUMS_URL" |
    awk "\$2 == \"patch-$VERSION.xz\" {print \$1}")"

sed -i \
    -e "s/^pkgver=.*/pkgver=${VERSION}/" \
    -e 's/^pkgrel=.*/pkgrel=1/' \
    -e "s/.* # patch$/            '$HASH' # patch/" \
    PKGBUILD

makepkg --printsrcinfo > .SRCINFO

git add -u
if ! git diff-index --quiet HEAD; then
    git commit -m "Updated to $VERSION"
fi