diff options
author | James Bunton | 2018-08-23 12:24:52 +1000 |
---|---|---|
committer | James Bunton | 2018-08-23 12:27:37 +1000 |
commit | 4cbd46087414506bbbb4c99daa9dfac24414f46b (patch) | |
tree | e1c43fede8c8a8a1b83051480189cecf2189224c /update.sh | |
parent | 0268d0e0cd9ffb1a98c42feace51ba78dd95fb5e (diff) | |
download | aur-4cbd46087414506bbbb4c99daa9dfac24414f46b.tar.gz |
update.sh
Diffstat (limited to 'update.sh')
-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 |