summarylogtreecommitdiffstats
path: root/update.sh
blob: c1c9d97ab043b4e02036055e5fa94257a39724ab (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 -x

git pull

pkgver="${1}"
if [[ -z "${pkgver}" ]]; then
	pkgver=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/apple/foundationdb/releases/latest | cut -d '/' -f 8)
fi

URL="https://github.com/apple/foundationdb/releases/download/${pkgver}/foundationdb-server_${pkgver}-1_amd64.deb"
chksum=$(curl -Ls "${URL}.sha256" | awk '{print $1}')

if [[ $(echo -n "${chksum}" | wc -c) -ne 64 ]]; then
	echo "Cannot download release"
	exit -2
fi

sed -i "s/pkgver=.*/pkgver=${pkgver}/g" PKGBUILD
sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=('${chksum}')/g" PKGBUILD

makepkg -f || exit -10
makepkg --printsrcinfo > .SRCINFO || exit -11


git commit -am "updated to ${pkgver}" || exit -12
git push || exit -13