aboutsummaryrefslogtreecommitdiffstats
path: root/util/gen-checksums
blob: bb1f981791b3299708d7252574a2b444fe00375d (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
#!/bin/sh
# See LICENSE file for copyright and license details.

set -e

if test ! $# = 2 || test -t 0 || test -t 1; then
	printf 'usage: %s tarball git-dir < version-info-file > checksum-listing\n' "$0" >&2
fi

tarball="$1"
gitdir="$2"

utildir="$(dirname -- "$0")"
(cd -- "${utildir}" && (make >/dev/null 2>/dev/null || make))

"${utildir}"/tmpmount /var/empty "${utildir}"/validate-tarball "${tarball}" "${gitdir}" /var/empty

grep '^Tarball: ' | cut -d ' ' -f 2 | grep -v '^https://maandree.se/static/' | (
        "${utildir}"/get-checksums "${tarball}"
        while read -r url; do
                "${utildir}"/tmpmount /var/empty "${utildir}"/get-and-check "${url}" "${gitdir}" /var/empty
        done
) | "${utildir}"/order-checksums