aboutsummarylogtreecommitdiffstats
path: root/update.sh
blob: f9778c8e2234fb0e7550e8b9339f92a9f4ac187c (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
29
30
31
32
33
34
#!/bin/bash

usage() {
	echo "${0} \<version\>"
}

# Update PKGBUILD with information from a new release.
if [[ -z ${1} ]]; then
	echo "No version specified."
	usage
	exit 1
fi
VERSION="${1}"

echo "Inserting package version '${VERSION}'."
sed -i -e "s/^pkgver=.*$/pkgver=${VERSION}/" PKGBUILD

# Source PKGBUILD to get access to variables.
. PKGBUILD

echo "Fetch checksums."
CHECKSUMS=()
for src in ${source[@]}; do
	# Fetch checksum.
	SHA512SUM=$(curl -s --output - ${src##*::} | sha512sum | cut -d" " -f1)
	echo "${SHA512SUM} - ${src##*::}"
	CHECKSUMS+=("${SHA512SUM}")
done

echo "Inserting checksum."
sed -i -e "s/^sha512sums=.*$/sha512sums=(${CHECKSUMS[@]})/" PKGBUILD

echo "Updating .SRCINFO."
makepkg --printsrcinfo > .SRCINFO