diff --git a/Makefile b/Makefile index c4fcab9..80dc545 100644 --- a/Makefile +++ b/Makefile @@ -173,3 +173,18 @@ release: release --clean --skip=validate .PHONY: release-dry-run release + +# Default DRS_VERSION if not set +DRS_VERSION ?= default-drs + +.PHONY: generate-genesis +generate-genesis: + @if [ -z "$(env)" ]; then \ + echo "Error: 'env' parameter is required. Use 'make generate-genesis env=mainnet' or 'make generate-genesis env=testnet'"; \ + exit 1; \ + fi + @if [ "$(env)" != "mainnet" ] && [ "$(env)" != "testnet" ]; then \ + echo "Error: 'env' must be either 'mainnet' or 'testnet'"; \ + exit 1; \ + fi + @./scripts/generate-genesis-template.sh $(env) $(DRS_VERSION) diff --git a/genesis-templates/genesis-mainnet.json b/genesis-templates/DRS/1/genesis-mainnet.json similarity index 100% rename from genesis-templates/genesis-mainnet.json rename to genesis-templates/DRS/1/genesis-mainnet.json diff --git a/genesis-templates/genesis-testnet.json b/genesis-templates/DRS/1/genesis-testnet.json similarity index 100% rename from genesis-templates/genesis-testnet.json rename to genesis-templates/DRS/1/genesis-testnet.json diff --git a/scripts/generate-genesis-template.sh b/scripts/generate-genesis-template.sh index a7fdf63..1793d4a 100755 --- a/scripts/generate-genesis-template.sh +++ b/scripts/generate-genesis-template.sh @@ -2,12 +2,14 @@ set -x # Get environment parameter -if [ $# -eq 0 ]; then - echo "Error: Environment parameter (mainnet/testnet) is required" +if [ $# -lt 2 ]; then + echo "Error: Both Environment (mainnet/testnet) and DRS parameters are required" exit 1 fi ENVIRONMENT=$1 +DRS=$2 + if [ "$ENVIRONMENT" != "mainnet" ] && [ "$ENVIRONMENT" != "testnet" ]; then echo "Error: Environment must be either 'mainnet' or 'testnet'" exit 1 @@ -77,11 +79,11 @@ update_params() { return 1 fi - # Create templates directory if it doesn't exist - mkdir -p ./genesis-templates + # Create templates directory with DRS subdirectory if it doesn't exist + mkdir -p "./genesis-templates/DRS/${DRS}" - # Copy the modified genesis file to the template location - cp "$TEMP_GENESIS" "./genesis-templates/genesis-${ENVIRONMENT}.json" + # Copy the modified genesis file to the DRS-specific template location + cp "$TEMP_GENESIS" "./genesis-templates/DRS/${DRS}/genesis-${ENVIRONMENT}.json" # Cleanup temp directory rm -rf "$TEMP_DIR"