#!/bin/sh set -e # Exit on failure GETH_DATA_DIR="/root/.ethereum" CONFIG_FILE="/config/config.toml" GENESIS_FILE="/config/genesis.json" # Initialize geth from genesis if data directory is empty if [ -z "$(ls -A "$GETH_DATA_DIR")" ]; then echo "abcore: data directory is empty, initializing from genesis..." if [ -f "$GENESIS_FILE" ]; then /abcore/bin/geth init --datadir "$GETH_DATA_DIR" "$GENESIS_FILE" else echo "abcore: genesis file not found at $GENESIS_FILE" >&2 exit 1 fi else echo "abcore: data directory not empty, continuing..." fi exec /abcore/bin/geth --config "$CONFIG_FILE" --datadir "$GETH_DATA_DIR" "$@"