Commit 322b5eca authored by Your Name's avatar Your Name

update ip param

parent 679f0424
...@@ -4,44 +4,72 @@ set -e ...@@ -4,44 +4,72 @@ set -e
isSeed=0 isSeed=0
withParam=0 withParam=0
input_string_ip="" input_string_my_ip=""
input_string_connected_ip=""
input_string_enr="" input_string_enr=""
if [ $# -eq 2 ]; then if [ $# -eq 3 ]; then
withParam=1 withParam=1
isSeed=1 isSeed=1
datadir=${1:-./data/} datadir=${1:-./data/}
input_string_ip=${2} input_string_my_ip=${2}
regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$' regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while true while true
do do
if [[ $input_string_ip =~ $regex ]]; then if [[ $input_string_my_ip =~ $regex ]]; then
break break
fi fi
echo ${input_string_ip}" is not a valid ip" echo ${input_string_my_ip}" is not a valid my ip"
echo "please input your p2p public ip address as seed: " echo "please input your p2p public ip address as peer: "
read input_string_ip read input_string_my_ip
done done
input_string_connected_ip=${3}
while true
do
if [[ $input_string_connected_ip =~ $regex ]]; then
break
fi
echo ${input_string_connected_ip}" is not a valid connected ip"
echo "please input your p2p public ip address as connected ip: "
read input_string_connected_ip
done
fi fi
if [ $# -eq 3 ]; then if [ $# -eq 4 ]; then
withParam=1 withParam=1
datadir=${1:-./data/} datadir=${1:-./data/}
input_string_ip=${2} input_string_my_ip=${2}
input_string_enr=${3} input_string_connected_ip=${3}
input_string_enr=${4}
regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$' regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while true while true
do do
if [[ $input_string_ip =~ $regex ]]; then if [[ $input_string_my_ip =~ $regex ]]; then
break break
fi fi
echo ${input_string_ip}" is not a valid ip" echo ${input_string_my_ip}" is not a valid my ip"
echo "please input your p2p public ip address as seed: " echo "please input your p2p public ip address as my service ip: "
read input_string_ip read input_string_my_ip
done done
while true
do
if [[ $input_string_connected_ip =~ $regex ]]; then
break
fi
echo ${input_string_connected_ip}" is not a valid connected ip"
echo "please input your connected sentry public ip address:"
read input_string_connected_ip
done
while true while true
do do
...@@ -62,44 +90,53 @@ fi ...@@ -62,44 +90,53 @@ fi
if [ $withParam -eq 0 ]; then if [ $withParam -eq 0 ]; then
read -p "please input your data dir:" datadir echo "please run the cmd with parameter "
datadir=${datadir:-./data/} echo ""
echo "run the node as seed"
echo "./host.sh /datadir myIpAsP2pSeed connectedSentryIp"
while true echo "run the node as normal node"
do echo "./host.sh /datadir myIpAsP2pSeed connectedSentryIp connectedPeerId"
echo "please input your p2p public ip address as seed: "
read input_string_ip
if [[ $input_string_ip =~ $regex ]]; then
break
fi
echo ${input_string_ip}" is not a valid ip"
echo "please input your p2p public ip address as seed: "
read input_string_ip
done
while true
do
echo "please input your p2p peer id, or cancel with no: "
read input_string_enr
echo "peer----------------"
echo ${input_string_enr##*/}
echo ${input_string_enr##*/} | wc -L
if [ $(echo ${input_string_enr##*/} | wc -L) -eq 53 ] ; then # read -p "please input your data dir:" datadir
break # datadir=${datadir:-./data/}
fi
# if [ $(echo ${input_string_enr} | wc -L) -eq 200 ] ; then # while true
# break # do
# fi # echo "please input your p2p public ip address as seed: "
if [ ${input_string_enr} == "no" ]; then # read input_string_ip
isSeed=1 # if [[ $input_string_ip =~ $regex ]]; then
break # break
fi # fi
echo ${input_string_enr}" is not a valid seed enr" # echo ${input_string_ip}" is not a valid ip"
echo "please input your p2p seed enr: " # echo "please input your p2p public ip address as seed: "
read input_string_enr # read input_string_ip
done # done
# while true
# do
# echo "please input your p2p peer id, or cancel with no: "
# read input_string_enr
# echo "peer----------------"
# echo ${input_string_enr##*/}
# echo ${input_string_enr##*/} | wc -L
# if [ $(echo ${input_string_enr##*/} | wc -L) -eq 53 ] ; then
# break
# fi
# # if [ $(echo ${input_string_enr} | wc -L) -eq 200 ] ; then
# # break
# # fi
# if [ ${input_string_enr} == "no" ]; then
# isSeed=1
# break
# fi
# echo ${input_string_enr}" is not a valid seed enr"
# echo "please input your p2p seed enr: "
# read input_string_enr
# done
fi fi
...@@ -107,17 +144,14 @@ fi ...@@ -107,17 +144,14 @@ fi
echo "isSeed " $isSeed echo "isSeed " $isSeed
echo "withParam " $withParam echo "withParam " $withParam
echo "input_string_ip " $input_string_ip echo "input_string_my_ip " $input_string_my_ip
echo "input_string_connected_ip " $input_string_connected_ip
echo "input_string_enr " $input_string_enr echo "input_string_enr " $input_string_enr
seedEnr=$input_string_enr seedEnr=$input_string_enr
ipAddr=$input_string_ip myIpAddr=$input_string_my_ip
connectedSentryIp=$input_string_connected_ip
...@@ -179,7 +213,7 @@ do ...@@ -179,7 +213,7 @@ do
echo "nebula-grpc-address: \"nebula:38004\"" >> $configFile echo "nebula-grpc-address: \"nebula:38004\"" >> $configFile
echo "grpc-host: \"0.0.0.0\"" >> $configFile echo "grpc-host: \"0.0.0.0\"" >> $configFile
echo "grpc-port: 38010" >> $configFile echo "grpc-port: 38010" >> $configFile
echo "p2p-host-ip: \"$ipAddr\"" >> $configFile echo "p2p-host-ip: \"$myIpAddr\"" >> $configFile
echo "peer: [\"${seedEnr}\"]" >> $configFile echo "peer: [\"${seedEnr}\"]" >> $configFile
...@@ -292,7 +326,7 @@ sentryConfig="app.json" ...@@ -292,7 +326,7 @@ sentryConfig="app.json"
echo "{" > $sentryConfig echo "{" > $sentryConfig
echo "\"contract\": \"0x054795542cA35Fb055b219ed647628935e5dDf96\"," >> $sentryConfig echo "\"contract\": \"0x054795542cA35Fb055b219ed647628935e5dDf96\"," >> $sentryConfig
echo "\"rpc_node\": \"http://$ipAddr:8545\"," >> $sentryConfig echo "\"rpc_node\": \"http://$connectedSentryIp:8545\"," >> $sentryConfig
echo "\"chain_id\": 1024," >> $sentryConfig echo "\"chain_id\": 1024," >> $sentryConfig
echo "\"main_account_priv\": \"F53D987FB2E98107A6AD7916AA8C6FF65F9C19D3F703AF7540002357ECAB69A1\"" >> $sentryConfig echo "\"main_account_priv\": \"F53D987FB2E98107A6AD7916AA8C6FF65F9C19D3F703AF7540002357ECAB69A1\"" >> $sentryConfig
echo "}" >> $sentryConfig echo "}" >> $sentryConfig
...@@ -411,10 +445,10 @@ echo "" >> $composefile ...@@ -411,10 +445,10 @@ echo "" >> $composefile
if [ $i -eq 1 ]; then # if [ $i -eq 1 ]; then
#echo "p2p-priv-key: \"/etc/MetaNet/default-priv-key\"" >> $configFile # #echo "p2p-priv-key: \"/etc/MetaNet/default-priv-key\"" >> $configFile
echo "" >> $composefile # echo "" >> $composefile
else # else
echo " nebula:" >> $composefile echo " nebula:" >> $composefile
echo " image: caduceus/cmp2-test-net-meta-nebula:v0.0.13" >> $composefile echo " image: caduceus/cmp2-test-net-meta-nebula:v0.0.13" >> $composefile
echo " container_name: nebula" >> $composefile echo " container_name: nebula" >> $composefile
...@@ -430,7 +464,7 @@ else ...@@ -430,7 +464,7 @@ else
echo " networks:" >> $composefile echo " networks:" >> $composefile
echo " - meta" >> $composefile echo " - meta" >> $composefile
echo "" >> $composefile echo "" >> $composefile
fi #fi
echo " ring:" >> $composefile echo " ring:" >> $composefile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment