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

86 lines
1.8 KiB
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-19 11:42:53 +00:00
. bundles.env
2022-04-07 13:24:10 +00:00
die() {
echo "$1"
exit 1
}
2022-04-19 11:42:53 +00:00
fetch() {
ver=$1
rel=$2
if [ ! -e $ver ]; then
mkdir $ver
2022-04-07 13:24:10 +00:00
fi
2022-04-19 11:42:53 +00:00
if [ -e $ver/release ]; then
cur=$(cat $ver/release)
if [ $cur == $rel ]; then
return 0
fi
fi
for net in mainnet caterpillarnet butterflynet calibrationnet devnet testing; do
fetch_bundle $ver $rel $net
done
# remember the current release so that we don't have to hit github unless we have modified it
echo $rel > $ver/release
2022-04-07 13:24:10 +00:00
}
2022-04-19 11:42:53 +00:00
fetch_bundle() {
ver=$1
rel=$2
net=$3
target=builtin-actors-$net.car
hash=builtin-actors-$net.sha256
pushd $ver
# fetch the hash first and check if it matches what we (may) already have
curl -L --retry 3 https://github.com/filecoin-project/builtin-actors/releases/download/$rel/$hash -o $hash || die "error fetching hash for $ver/$net"
2022-04-19 16:12:25 +00:00
if [ -e $target ]; then
if (shasum -a 256 --check $hash); then
popd
return 0
fi
2022-04-07 13:24:10 +00:00
fi
2022-04-19 11:42:53 +00:00
# we don't have the (correct) bundle, fetch it
curl -L --retry 3 https://github.com/filecoin-project/builtin-actors/releases/download/$rel/$target -o $target || die "error fetching bundle for $ver/$net"
# verify
shasum -a 256 --check $hash || die "hash mismatch"
# all good
popd
2022-04-07 13:24:10 +00:00
}
touch_bundles() {
ver=$1
if [ ! -e $ver ]; then
mkdir $ver
fi
for net in mainnet caterpillarnet butterflynet calibrationnet devnet testing; do
touch $ver/builtin-actors-$net.car
done
}
2022-04-19 11:42:53 +00:00
if [ -n "$actors7_release" ]; then
fetch v7 "$actors7_release"
else
touch_bundles v7
2022-04-07 13:24:10 +00:00
fi
2022-04-19 11:42:53 +00:00
if [ -n "$actors8_release" ]; then
fetch v8 "$actors8_release"
else
touch_bundles v8
2022-04-07 13:24:10 +00:00
fi