aboutsummaryrefslogtreecommitdiffstats
path: root/util/gen-checksums
blob: 2d404a0c22e58ce2d5b36f50f34ce73b03e60669 (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
25
26
#!/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 < tarball-url-list > 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

get_checksums () {
        "${utildir}"/get-checksums "${tarball}"
	while read -r url; do
                "${utildir}"/tmpmount /var/empty "${utildir}"/get-and-check "${url}" "${gitdir}" /var/empty
	done
}

checksums="$(get_checksums)"
printf '%s\n' "$checksums" | "${utildir}"/order-checksums