aboutsummaryrefslogtreecommitdiffstats
path: root/gen-checksums
blob: d33b7b239139e7e24ed3f3f70ac02d10b3e8bc1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

set -e

if test ! $# = 3; then
	printf 'usage: %s git-dir project version\n' "$0" >&2
	exit 1
fi

die () {
	printf '%s\n' "$@" >&2
	exit 1
}

gitdir="$1"
tarball=".static/$2-$3.tar.gz"
infofile="rel/$2/$3.info"
sumfile="rel/$2/$3.checksums"
test -e "${tarball}" || die "${tarball} does not exist"
test -e "${infofile}" || die "${infofile} does not exist"

grep '^Tarball: ' < "${infofile}" | cut -d ' ' -f 2 | \
	grep -v '^https://maandree.se/static/' |
	"$(dirname -- "$0")"/util/gen-checksums "${tarball}" "${gitdir}" > "${sumfile}"