2021-08-24 17:06:45 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -o pipefail -o nounset -o errexit
|
|
|
|
|
|
|
|
# set current working directory to script directory to run script from everywhere
|
|
|
|
cd "$(dirname "$0")"
|
2023-05-08 17:55:27 +04:00
|
|
|
PACKAGE_DIR="$(pwd)/../registry"
|
|
|
|
SCHEDULED="$PACKAGE_DIR/scheduled"
|
2021-08-24 17:06:45 +03:00
|
|
|
|
2023-05-08 17:55:27 +04:00
|
|
|
(
|
|
|
|
rm -rf $PACKAGE_DIR
|
|
|
|
mkdir -p $PACKAGE_DIR
|
|
|
|
)
|
2021-08-24 17:06:45 +03:00
|
|
|
(
|
|
|
|
echo "*** compile scheduled scripts ***"
|
|
|
|
cd ../aqua
|
2023-06-19 20:30:24 +03:00
|
|
|
npx fluence --version
|
|
|
|
npx fluence aqua --no-relay --air -i ./registry-scheduled-scripts.aqua -o "$SCHEDULED"
|
2021-08-24 17:06:45 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
echo "*** copy wasm files ***"
|
|
|
|
cd ../service
|
2023-05-08 17:55:27 +04:00
|
|
|
cp artifacts/*.wasm "$PACKAGE_DIR"
|
2021-08-24 17:06:45 +03:00
|
|
|
)
|
|
|
|
|
2023-05-08 17:55:27 +04:00
|
|
|
REGISTRY_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/registry.wasm)
|
|
|
|
SQLITE_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/sqlite3.wasm)
|
|
|
|
mv $PACKAGE_DIR/registry.wasm "$PACKAGE_DIR"/"$REGISTRY_CID".wasm
|
|
|
|
mv $PACKAGE_DIR/sqlite3.wasm "$PACKAGE_DIR"/"$SQLITE_CID".wasm
|
|
|
|
cp registry_config.json "$PACKAGE_DIR"/"$REGISTRY_CID"_config.json
|
|
|
|
cp sqlite3_config.json "$PACKAGE_DIR"/"$SQLITE_CID"_config.json
|
|
|
|
|
|
|
|
# write blueprint.json
|
|
|
|
echo "{}" | jq --arg registry_cid "$REGISTRY_CID" --arg sqlite_cid "$SQLITE_CID" '{"name": "registry", "dependencies":[{"/":$sqlite_cid},{"/":$registry_cid}]}' > "$PACKAGE_DIR/blueprint.json"
|
|
|
|
|
|
|
|
|
2021-09-16 15:25:28 +03:00
|
|
|
(
|
|
|
|
echo "*** create builtin distribution package ***"
|
|
|
|
cd ..
|
2023-05-08 17:55:27 +04:00
|
|
|
tar -f registry.tar.gz -zcv ./registry
|
2021-09-16 15:25:28 +03:00
|
|
|
)
|
|
|
|
|
2021-08-24 17:06:45 +03:00
|
|
|
echo "*** done ***"
|