lotus/build/builtin-actors/fetch-bundles.sh

53 lines
990 B
Bash
Raw Normal View History

2022-04-07 13:24:10 +00:00
#!/bin/bash
set -e
2022-04-13 09:14:55 +00:00
cd "$(dirname "$0")"
2022-04-07 13:24:10 +00:00
2022-04-07 17:59:09 +00:00
# gateway to use
dweb="dweb.link"
2022-04-07 13:24:10 +00:00
actors7_cid=""
actors7_hash=""
actors8_cid="bafybeictmywrut5tprz5fnoti6adfwuvixvrfardhqwldxosmdsfavc56e"
actors8_hash="687b38f59b0c32800f55a8f1f303de214ec173c90e653984d67f393bc41c1416"
die() {
echo "$1"
exit 1
}
check() {
file=$1
hash=$2
if [ -e "$file" ]; then
2022-04-13 09:14:55 +00:00
echo "$hash $file" | shasum -a 256 --check
2022-04-07 13:24:10 +00:00
else
return 1
fi
}
fetch() {
output=$1
cid=$2
hash=$3
2022-04-13 09:14:55 +00:00
if (check "$output" "$hash"); then
2022-04-07 13:24:10 +00:00
return 0
else
echo "fetching $cid to $output"
2022-04-13 09:14:55 +00:00
curl -k "https://$dweb/ipfs/$cid" -o "$output"
check "$output" "$hash" || die "hash mismatch"
2022-04-07 13:24:10 +00:00
fi
}
2022-04-13 09:14:55 +00:00
if [ -n "$actors7_cid" ]; then
2022-04-07 13:24:10 +00:00
fetch builtin-actors-v7.car "$actors7_cid" "$actors7_hash"
else
touch builtin-actors-v7.car
fi
2022-04-13 09:14:55 +00:00
if [ -n "$actors8_cid" ]; then
2022-04-07 13:24:10 +00:00
fetch builtin-actors-v8.car "$actors8_cid" "$actors8_hash"
else
touch builtin-actors-v8.car
fi