summarylogtreecommitdiffstats
path: root/upgrade.sh
blob: 6a4eaf9eed77a2ceaec380f75c5967e762e20902 (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
28
#!/bin/bash
set -e

if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
    echo "Usage: $0 [-h|--help] version" >&2
    exit 1
fi

. ./PKGBUILD
sed -i "s/$pkgver/$1/" PKGBUILD
. ./PKGBUILD

tmp="$(mktemp)"
cleanup() { rm -f "$tmp"; }
trap cleanup EXIT

curl -fsL "${source[0]}" -o "$tmp"
sum="$(sha256sum "$tmp" | cut -c -64)"

cleanup
unset cleanup
trap - EXIT

sed -i -e "s/${sha256sums[0]}/$sum/g" PKGBUILD
makepkg --printsrcinfo > .SRCINFO

git add .
git commit -m "Upgrade to $1"