summarylogtreecommitdiffstats
path: root/update.sh
blob: ea05959fc2ffba2d1394e6810899a187eb1facd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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