From 091b85022acbbc7085aa21ee859fd80b7b554b2b Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Fri, 1 Mar 2019 17:16:14 -0300 Subject: [PATCH] Cambios en start.sh --- bin/libbfa.sh | 56 ++++++++++++++++++++++++++++----------------------- bin/start.sh | 20 ++++++++++-------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/bin/libbfa.sh b/bin/libbfa.sh index 7a635eb..1c216d5 100644 --- a/bin/libbfa.sh +++ b/bin/libbfa.sh @@ -99,21 +99,34 @@ function geth_rpc echo "$json" | jq .result } +function create_account +{ + geth --cache 0 --datadir ${BFANODEDIR} --password /dev/null account new +} + function extradata { - # something uniqueish - ## find default interface - local def_if=$( - ( ip -4 route show ; ip -6 route show ) | - expand | - sed -ne '/^default /{s/ */ /g;s/^.* dev //;s/ .*//;p;q}' - ) - local mymac=$( - ip link show ${def_if} | - sed -ne '/link\|ether/{s/^.*link.ether //;s/ .*//;s/://g;p;q}' + local acct=$( + ls -1d "${BFANODEDIR}"/keystore/*--* 2>/dev/null | + head -1 | + sed 's/.*--//' ) - # - echo -n "${BFAACCOUNT:0:19}.${mymac:0:12}" + if [ -n "$acct" ] + then + # something uniqueish + ## find default interface + local def_if=$( + ( ip -4 route show ; ip -6 route show ) | + expand | + sed -ne '/^default /{s/ */ /g;s/^.* dev //;s/ .*//;p;q}' + ) + local mymac=$( + ip link show ${def_if} | + sed -ne '/link\|ether/{s/^.*link.ether //;s/ .*//;s/://g;p;q}' + ) + # + echo -n "${acct:0:19}.${mymac:0:12}" + fi } function prereq @@ -191,6 +204,10 @@ then netport=$( cat ${BFANODEDIR}/netport ) test $? = 0 fi +if [ "$netport" != "30303" ] +then + netportarg="--port ${netport}" +fi # # rpcport rpcport=8545 @@ -199,18 +216,7 @@ then rpcport=$( cat ${BFANODEDIR}/rpcport ) test $? = 0 fi -# -# BFAACCOUNT -if [ -z "$BFAACCOUNT" ] +if [ "$rpcport" != "8545" ] then - if ! ls -1d ${BFANODEDIR}/keystore/*--* >/dev/null 2>&1 - then - echo "No accounts found. Creating a new one (they are free)." - geth --cache 0 --datadir ${BFANODEDIR} --password /dev/null account new - fi - BFAACCOUNT=$( - ls -1d "${BFANODEDIR}"/keystore/*--* 2>/dev/null | - head -1 | - sed 's/.*--//' - ) + rpcportarg="--rpcport ${rpcport}" fi diff --git a/bin/start.sh b/bin/start.sh index 38d4f4b..4c33b36 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -26,10 +26,6 @@ function getsyncmode echo "--syncmode ${syncmode}" } -test -n "${BFAACCOUNT}" || - fatal "No account defined." - - function startbootnode { local ERRTEXT="bootnode section failed" @@ -101,18 +97,26 @@ function startgeth echo # (re)configure parameters (you never know if they changed) flexargs="$( getsyncmode ) --extradata $( extradata )" + if [ "$netport" != 30303 ] + then + flexargs="${flexargs} --net $netport" + fi + if [ "$rpcport" != 30303 ] + then + flexargs="${flexargs} --rpcport $rpcport" + fi + if [ -n "$BFAVERBOSITY" -a "$BFAVERBOSITY" != 3 ] + then + flexargs="${flexargs} --verbosity ${BFAVERBOSITY:-3}" + fi set -x geth \ --datadir ${BFANODEDIR} \ --networkid ${BFANETWORKID} \ --rpc \ - --rpcport $rpcport \ --rpcapi "eth,net,web3,admin,clique,miner,personal" \ - --port $netport \ - --nousb \ --gcmode archive \ --cache 512 \ - --verbosity ${BFAVERBOSITY:-3} \ ${flexargs} \ --bootnodes "${bootnodes}" & set +x -- GitLab