all-in-one paramfetch

This commit is contained in:
Łukasz Magiera 2019-09-25 21:13:28 +02:00 committed by whyrusleeping
parent a2a2169ef8
commit 99c9221082
4 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
**/*.a
**/*.pc
build/.*
build/paramfetch.sh
/vendor
*-fuzz.zip

View File

@ -56,8 +56,11 @@ bin/ipget:
PARAM_SECTOR_SIZES:=1024 16777216 268435456 1073741824
PARAM_SECTOR_SIZES:=$(addprefix build/.params-,$(PARAM_SECTOR_SIZES))
$(PARAM_SECTOR_SIZES): build/proof-params/parameters.json bin/ipget
./build/proof-params/paramfetch.sh
./build/paramfetch.sh: build/proof-params/parameters.json
build/proof-params/mkparamfetch.sh
$(PARAM_SECTOR_SIZES): ./build/paramfetch.sh build/proof-params/parameters.json bin/ipget
./build/paramfetch.sh
touch $@
BUILD_DEPS+=build/.params-1024

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
sed "s/{{PARAMSJSON}}/$(base64 build/proof-params/parameters.json -w 0)/g" build/proof-params/paramfetch.sh.template > ./build/paramfetch.sh
chmod +x ./build/paramfetch.sh

View File

@ -2,6 +2,8 @@
set -euo pipefail
PARAMS='{{PARAMSJSON}}'
die() {
echo "$@" >&2
exit 1
@ -73,10 +75,9 @@ fetch_gateway() {
}
OUT_DIR="/var/tmp/filecoin-proof-parameters"
PARAMS="build/proof-params/parameters.json"
mkdir -p $OUT_DIR
jq '. | to_entries | map("'$OUT_DIR'/\(.key) \(.value.cid) \(.value.digest)") | .[]' --raw-output $PARAMS | \
printf $PARAMS | base64 -d | jq '. | to_entries | map("'$OUT_DIR'/\(.key) \(.value.cid) \(.value.digest)") | .[]' --raw-output | \
while read -r dest cid digest; do
if [[ -f "$dest" ]]; then
b2=$(b2sum "$dest" | head -c 32)