Skip to content
Snippets Groups Projects
Commit 477b317e authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Trying to get geth to init itself for first timers

parent fb94f9bc
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,7 @@ function networkdir
exit 1
fi
getnetworkid
gen_genesis
}
function nodedir
......@@ -104,18 +105,24 @@ function nodedir
# If there is no nodedir found, use the first node we
# find in the networkdir
BFANODEDIR=$(
ls -1d "${BFANETWORKDIR}"/*/keystore |
sort --version-sort |
ls -1d "${BFANETWORKDIR}"/*/keystore 2>/dev/null |
sort --version-sort |
head -1
)
# Get rid of the keystore label
BFANODEDIR=$( dirname $BFANODEDIR )
if [ -z "${BFANODEDIR}" ]
then
BFANODEDIR="${BFANETWORKDIR}/node1"
echo "No node directories found. Initialising a new node."
geth --datadir ${BFANODEDIR} init ${BFAHOME}/src/genesis.json
else
# Get rid of the "keystore" label
BFANODEDIR=$( dirname $BFANODEDIR )
fi
fi
test -n "${BFANODEDIR}" ||
fatal "Unable to guess \$BFANODEDIR . Consider setting it explicitly in ${BFAHOME}/bin/env"
test -d "${BFANODEDIR}" ||
fatal "$BFANODEDIR is not a directory."
gen_genesis
test -d "${BFANODEDIR}/geth/chaindata" ||
fatal "Node is not initialised. Consider running: geth --datadir $BFANODEDIR init ${BFAHOME}/src/genesis.json"
# Support migrating from "former" setups
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment