diff --git a/scripts/renew-config.sh b/scripts/renew-config.sh index 80bd9d8..09b1e9d 100755 --- a/scripts/renew-config.sh +++ b/scripts/renew-config.sh @@ -11,7 +11,6 @@ production_meta_url="https://github.com/gear-tech/gear/releases/download/v"$tag" echo "Downloading testnet metadata from $testnet_meta_url" testnet_metadata=$(curl -L $testnet_meta_url) - if [ $? -ne 0 ]; then echo "Failed to download testnet metadata" exit 1 @@ -19,27 +18,13 @@ fi echo "Downloading production metadata from $production_meta_url" production_metadata=$(curl -L $production_meta_url) - if [ $? -ne 0 ]; then echo "Failed to download production metadata" exit 1 fi -# Convert metadata to JSON format if needed -testnet_metadata_json=$(echo "$testnet_metadata" | jq .) -if [ $? -ne 0 ]; then - echo "Failed to parse testnet metadata as JSON" - exit 1 -fi - -production_metadata_json=$(echo "$production_metadata" | jq .) -if [ $? -ne 0 ]; then - echo "Failed to parse production metadata as JSON" - exit 1 -fi - echo "Updating testnet config" -jq --argjson version "$version" --argjson metadata "$testnet_metadata_json" \ +jq --arg metadata "$testnet_metadata" --argjson version "$version" \ '.metadataRpc = $metadata | .specVersion = $version' \ "$TESTNET_CONFIG_PATH" > tmp.$$.json \ && mv tmp.$$.json "$TESTNET_CONFIG_PATH" @@ -50,14 +35,10 @@ if [ $? -ne 0 ]; then fi echo "Updating mainnet config" -jq --argjson version "$version" --argjson metadata "$production_metadata_json" \ +jq --arg metadata "$production_metadata" --argjson version "$version" \ '.metadataRpc = $metadata | .specVersion = $version' \ "$MAINNET_CONFIG_PATH" > tmp.$$.json \ && mv tmp.$$.json "$MAINNET_CONFIG_PATH" if [ $? -ne 0 ]; then - echo "Failed to update mainnet config" - exit 1 -fi - -echo "Configuration update completed successfully" + echo "Failed to update mainnet config