#! /bin/sh if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "help" ] || [ -z "$1" ]; then cat </dev/null || { echo "wget is not installed" 1>&2; exit 127; } command -v makepkg >/dev/null || { echo "makepkg was not found" 1>&2; exit 127; } command -v git >/dev/null || { echo "git is not installed" 1>&2; exit 127; } VERSION="$1" CHECKSUMS_FILE="checksums-$VERSION.txt" # update version nr sed -r "s/^pkgver=.*$/pkgver=\"$VERSION\"/g" PKGBUILD -i # get checksums wget -q -nc "https://github.com/jonaslu/ain/releases/download/v$VERSION/checksums.txt" -O $CHECKSUMS_FILE SUM_x86="$(grep 'linux_x86_64.tar.gz$' $CHECKSUMS_FILE | cut -d\ -f1)" SUM_arm="$(grep 'linux_arm64.tar.gz$' $CHECKSUMS_FILE | cut -d\ -f1)" SUM_i386="$(grep 'linux_i386.tar.gz$' $CHECKSUMS_FILE | cut -d\ -f1)" # upate shasums sed -r "s/sha256sums_x86_64=\([\"'][^\"']+[\"']\)$/sha256sums_x86_64=(\"$SUM_x86\")/" PKGBUILD -i sed -r "s/sha256sums_aarch64=\([\"'][^\"']+[\"']\)$/sha256sums_aarch64=(\"$SUM_arm\")/" PKGBUILD -i sed -r "s/sha256sums_i386=\([\"'][^\"']+[\"']\)$/sha256sums_i386=(\"$SUM_i386\")/" PKGBUILD -i # regenerate .SRCINFO makepkg -f && makepkg --printsrcinfo > .SRCINFO # sanity check namcap PKGBUILD namcap *.pkg.tar.zst # check changes git --no-pager diff PKGBUILD # cleanup temp rm -r src pkg *.tar* git status printf "Commit and push changes? (Y/n): " read ans if [ "$ans" != "n" ] && [ "$ans" != "N" ]; then git add -A git commit -m "Release $VERSION" git push origin master fi