install aggregate-results.sh too
Juan Batiz-Benet committed
Nov 6, 2014 at 16:32 UTC
54651618e8e51e2a2abaea7abd861a7a2bf1189c
1 file changed
+36
-15
test/install-sharness.sh
+36
-15
@@ -7,22 +7,43 @@
7
8
# settings
9
version=50229a79ba22b2f13ccd82451d86570fecbd194c
10
-hash1=eeaf96630fc25ec58fb678b64ef9772d5eb92f64
11
-url=https://raw.githubusercontent.com/mlafeldt/sharness/$version/sharness.sh
12
-file=sharness.sh
13
-
14
-# download it
15
-wget -q $url -O $file.test
16
-
17
-# verify it's the right file
18
-hash2=`cat $file.test | shasum | cut -c1-40`
19
-if test "$hash1" != "$hash2"; then
20
- echo "$file verification failed"
21
- echo "$hash1 != $hash2"
22
- rm $file.test
10
+urlprefix=https://raw.githubusercontent.com/mlafeldt/sharness/$version
11
+
12
+# files to download
13
+sfile=sharness.sh
14
+shash=eeaf96630fc25ec58fb678b64ef9772d5eb92f64
15
+
16
+afile=aggregate-results.sh
17
+ahash=948d6bc03222c5c00a1ed048068508d5ea1cce59
18
+
19
+verified_download() {
20
+ file=$1
21
+ hash1=$2
22
+ url=$urlprefix/$file
23
+
24
+ # download it
25
+ wget -q $url -O $file.test
26
+
27
+ # verify it's the right file
28
+ hash2=`cat $file.test | shasum | cut -c1-40`
29
+ if test "$hash1" != "$hash2"; then
30
+ echo "$file verification failed:"
31
+ echo " $hash1 != $hash2"
32
+ return -1
33
+ fi
34
+ return 0
35
+}
36
+
37
+
38
+verified_download "$sfile" "$shash"; sok=$?
39
+verified_download "$afile" "$ahash"; aok=$?
40
+if test "$sok" != 0 || test "$aok" != 0; then
41
+ rm $afile.test
42
+ rm $sfile.test
43
exit -1
44
fi
45
26
-# ok, move it into place
27
-mv $file.test $file
46
+# ok, move things into place
47
+mv $sfile.test $sfile
48
+mv $afile.test $afile
49
exit 0