Skip to content

Commit df97e17

Browse files
author
Ian Harris
committed
fix: use x-goog-hash rather than etag
1 parent 3fb56ce commit df97e17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/docs/snapshots.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If using fetchd >= 0.10.4
2727

2828
### Download and install the snapshot
2929

30-
Many options here! The example below assumes a bash-like environment, uses a single connection for downloading, confirms the md5sum of the downloaded data against that of the original, and does not land the original compressed data to disk. This is a good starting point, but depending on your local environment you may wish to make adaptations that eg sacrifice disk space and extra md5sum complexity for the benefit of parallel downloads with aria2. Entirely up to you!
30+
Many options here! The example below assumes a bash-like environment, uses a single connection for downloading, confirms the md5sum of the downloaded data against that of the original, and does not land the original compressed data to disk. This is a good starting point, but depending on your local environment you may wish to make adaptations that eg sacrifice disk space and extra md5sum complexity for the benefit of parallel downloads with aria2. Entirely up to you... let us know how you get on!
3131

3232
```bash
3333
# (optional) show the timestamp of the latest available snapshot
@@ -37,7 +37,7 @@ echo "Latest available snapshot timestamp : $(curl -s -I https://storage.google
3737
curl -v https://storage.googleapis.com/fetch-ai-mainnet-snapshots/fetchhub-4-pruned.tgz -o- 2>headers.out | tee >(md5sum > md5sum.out) | gunzip -c | tar -xvf - --directory=~/.fetchd
3838

3939
# (optional, but recommended) compare source md5 checksum provided in the headers by google, with the one calculated locally
40-
[[ $(awk -F\" '/etag:/{ print $2 }' headers.out) == $(awk '{ print $1 }' md5sum.out) ]] && echo "OK - md5sum match" || echo "ERROR - md5sum MISMATCH"
40+
[[ $(grep 'x-goog-hash: md5' headers.out | sed -z 's/^.*md5=\(.*\)/\1/g' | tr -d '\r' | base64 -d | od -An -vtx1 | tr -d ' \n') == $(awk '{ print $1 }' md5sum.out) ]] && echo "OK - md5sum match" || echo "ERROR - md5sum MISMATCH"
4141

4242
# (optional) show the creation date of the downloaded snapshot
4343
echo "Downloaded snapshot timestamp: $(grep last-modified headers.out | cut -f3- -d' ')"

0 commit comments

Comments
 (0)