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

Cambios en start.sh

parent b8d741f4
No related branches found
No related tags found
No related merge requests found
...@@ -99,21 +99,34 @@ function geth_rpc ...@@ -99,21 +99,34 @@ function geth_rpc
echo "$json" | jq .result echo "$json" | jq .result
} }
function create_account
{
geth --cache 0 --datadir ${BFANODEDIR} --password /dev/null account new
}
function extradata function extradata
{ {
# something uniqueish local acct=$(
## find default interface ls -1d "${BFANODEDIR}"/keystore/*--* 2>/dev/null |
local def_if=$( head -1 |
( ip -4 route show ; ip -6 route show ) | sed 's/.*--//'
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}'
) )
# if [ -n "$acct" ]
echo -n "${BFAACCOUNT:0:19}.${mymac:0:12}" 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 function prereq
...@@ -191,6 +204,10 @@ then ...@@ -191,6 +204,10 @@ then
netport=$( cat ${BFANODEDIR}/netport ) netport=$( cat ${BFANODEDIR}/netport )
test $? = 0 test $? = 0
fi fi
if [ "$netport" != "30303" ]
then
netportarg="--port ${netport}"
fi
# #
# rpcport # rpcport
rpcport=8545 rpcport=8545
...@@ -199,18 +216,7 @@ then ...@@ -199,18 +216,7 @@ then
rpcport=$( cat ${BFANODEDIR}/rpcport ) rpcport=$( cat ${BFANODEDIR}/rpcport )
test $? = 0 test $? = 0
fi fi
# if [ "$rpcport" != "8545" ]
# BFAACCOUNT
if [ -z "$BFAACCOUNT" ]
then then
if ! ls -1d ${BFANODEDIR}/keystore/*--* >/dev/null 2>&1 rpcportarg="--rpcport ${rpcport}"
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/.*--//'
)
fi fi
...@@ -26,10 +26,6 @@ function getsyncmode ...@@ -26,10 +26,6 @@ function getsyncmode
echo "--syncmode ${syncmode}" echo "--syncmode ${syncmode}"
} }
test -n "${BFAACCOUNT}" ||
fatal "No account defined."
function startbootnode function startbootnode
{ {
local ERRTEXT="bootnode section failed" local ERRTEXT="bootnode section failed"
...@@ -101,18 +97,26 @@ function startgeth ...@@ -101,18 +97,26 @@ function startgeth
echo echo
# (re)configure parameters (you never know if they changed) # (re)configure parameters (you never know if they changed)
flexargs="$( getsyncmode ) --extradata $( extradata )" 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 set -x
geth \ geth \
--datadir ${BFANODEDIR} \ --datadir ${BFANODEDIR} \
--networkid ${BFANETWORKID} \ --networkid ${BFANETWORKID} \
--rpc \ --rpc \
--rpcport $rpcport \
--rpcapi "eth,net,web3,admin,clique,miner,personal" \ --rpcapi "eth,net,web3,admin,clique,miner,personal" \
--port $netport \
--nousb \
--gcmode archive \ --gcmode archive \
--cache 512 \ --cache 512 \
--verbosity ${BFAVERBOSITY:-3} \
${flexargs} \ ${flexargs} \
--bootnodes "${bootnodes}" & --bootnodes "${bootnodes}" &
set +x set +x
......
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