This commit is contained in:
goldsquid
2025-09-16 16:28:06 +07:00
parent 0f17a89913
commit b4c6e9628c

View File

@@ -17,11 +17,10 @@ case "$MODE" in
geth) geth)
GETH_DATA_DIR="/root/.ethereum/" GETH_DATA_DIR="/root/.ethereum/"
if [ ! -f "$GETH_DATA_DIR/initialized" ]; then if [ -z "$(ls -A "$GETH_DATA_DIR")" ]; then
/0g/bin/geth init --datadir $GETH_DATA_DIR /0g/genesis.json /0g/bin/geth init --datadir $GETH_DATA_DIR /0g/genesis.json
touch "$GETH_DATA_DIR/initialized"
else else
echo "Already initialized, continuing!" >&2 echo "Datadir not empty, continuing!" >&2
fi fi
exec /0g/bin/geth $@ exec /0g/bin/geth $@
@@ -48,8 +47,20 @@ mkdir $DATA_DIR
env env
if /0g/bin/0gchaind init ${MONIKER} --home $HOME_DIR; then if [ ! -f "$HOME_DIR/priv_validator_state.json" ]; then
cp -r /0g/0g-home/0gchain-home/config/* $CONFIG_DIR TMP_DIR=$(mktemp -d)
echo "priv_validator_state.json not found in $HOME_DIR. Proceeding with initialization steps..."
# You can add any additional initialization logic here if needed
if /0g/bin/0gchaind init ${MONIKER} --home $TMP_DIR; then
cp -r /0g/0g-home/0gchaind-home/config/* $CONFIG_DIR
cp $TMP_DIR/data/priv_validator_state.json $DATA_DIR
cp $TMP_DIR/config/node_key.json $CONFIG_DIR
cp $TMP_DIR/config/priv_validator_key.json $CONFIG_DIR
else
echo "Already initialized, continuing!" >&2
fi
rm -rf $TMP_DIR # delete tmp dir
else else
echo "Already initialized, continuing!" >&2 echo "Already initialized, continuing!" >&2
fi fi