diff options
-rwxr-xr-x | update.sh | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/update.sh b/update.sh index 73bc6931ddf6..2ba40f100753 100755 --- a/update.sh +++ b/update.sh @@ -4,9 +4,23 @@ set -eu cd "$(dirname "$0")" -VERSION="$(curl -sSf https://www.kernel.org/releases.json | jq -r '.releases[].version' | grep '^4\.4\.')" -HASH="$(curl -sSLf https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc | grep "patch-${VERSION}.xz" | cut -d' ' -f1)" +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/.* # patch$/ '$HASH' # patch/" \ + PKGBUILD -sed -i "s/pkgver=.*/pkgver=${VERSION}/" PKGBUILD -sed -i "s/.* # patch$/ '$HASH' # patch/" PKGBUILD makepkg --printsrcinfo > .SRCINFO + +git add . +if ! git diff-index --quiet HEAD; then + git commit -m "Updated to $VERSION" +fi |