File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
mithril-aggregator-fake/scripts Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -31,16 +31,34 @@ download_artifacts() {
31
31
echo -n " Downloading ${artifact} data: "
32
32
tput sc;
33
33
34
- for digest in $( jq -r .[].${json_field} < $DATA_DIR /${artifact} s.json) ;
34
+ for field in $( jq -r .[].${json_field} < $DATA_DIR /${artifact} s.json) ;
35
35
do
36
36
tput rc;
37
- wget -O $DATA_DIR /${artifact} -${digest } .json --quiet " ${url} /${digest } "
37
+ wget -O $DATA_DIR /${artifact} -${field } .json --quiet " ${url} /${field } "
38
38
let " nb=nb+1"
39
39
echo -n " $nb "
40
40
done
41
41
echo
42
42
}
43
43
44
+ download_certificate_chain () {
45
+ echo -n " Downloading certificate chain: "
46
+ tput sc;
47
+ local parent_hash=$( jq -r .[0].hash $DATA_DIR /certificates.json) ;
48
+ local certificate_hash;
49
+
50
+ until [ -z " $parent_hash " ];
51
+ do
52
+ certificate_hash=$parent_hash ;
53
+ wget -O $DATA_DIR /certificate-${certificate_hash} .json --quiet " ${BASE_URL} /certificate/${certificate_hash} " ;
54
+ parent_hash=$( jq -r .previous_hash $DATA_DIR /certificate-${certificate_hash} .json) ;
55
+ echo -n " ${parent_hash} " ;
56
+ tput rc;
57
+ done
58
+
59
+ echo " ok " ;
60
+ }
61
+
44
62
# MAIN execution
45
63
46
64
declare -r DATA_DIR=${1:? " No data directory given to download JSON files." } ;
@@ -54,7 +72,7 @@ export DATA_DIR URL;
54
72
clean_directory;
55
73
56
74
download_list $BASE_URL /certificates certificates
57
- download_artifacts $BASE_URL /certificate certificate " hash "
75
+ download_certificate_chain
58
76
59
77
download_list $BASE_URL /artifact/snapshots snapshots
60
78
download_artifacts $BASE_URL /artifact/snapshot snapshot digest
You can’t perform that action at this time.
0 commit comments