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

update ip param

parent 679f0424
......@@ -4,44 +4,72 @@ set -e
isSeed=0
withParam=0
input_string_ip=""
input_string_my_ip=""
input_string_connected_ip=""
input_string_enr=""
if [ $# -eq 2 ]; then
if [ $# -eq 3 ]; then
withParam=1
isSeed=1
datadir=${1:-./data/}
input_string_ip=${2}
input_string_my_ip=${2}
regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while true
do
if [[ $input_string_ip =~ $regex ]]; then
if [[ $input_string_my_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
echo ${input_string_my_ip}" is not a valid my ip"
echo "please input your p2p public ip address as peer: "
read input_string_my_ip
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
if [ $# -eq 3 ]; then
if [ $# -eq 4 ]; then
withParam=1
datadir=${1:-./data/}
input_string_ip=${2}
input_string_enr=${3}
input_string_my_ip=${2}
input_string_connected_ip=${3}
input_string_enr=${4}
regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while true
do
if [[ $input_string_ip =~ $regex ]]; then
if [[ $input_string_my_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
echo ${input_string_my_ip}" is not a valid my ip"
echo "please input your p2p public ip address as my service ip: "
read input_string_my_ip
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
do
......@@ -62,44 +90,53 @@ fi
if [ $withParam -eq 0 ]; then
read -p "please input your data dir:" datadir
datadir=${datadir:-./data/}
echo "please run the cmd with parameter "
echo ""
echo "run the node as seed"
echo "./host.sh /datadir myIpAsP2pSeed connectedSentryIp"
while true
do
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
echo "run the node as normal node"
echo "./host.sh /datadir myIpAsP2pSeed connectedSentryIp connectedPeerId"
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
# read -p "please input your data dir:" datadir
# datadir=${datadir:-./data/}
# 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
# while true
# do
# 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
# 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
......@@ -107,17 +144,14 @@ fi
echo "isSeed " $isSeed
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
seedEnr=$input_string_enr
ipAddr=$input_string_ip
myIpAddr=$input_string_my_ip
connectedSentryIp=$input_string_connected_ip
......@@ -179,10 +213,10 @@ do
echo "nebula-grpc-address: \"nebula:38004\"" >> $configFile
echo "grpc-host: \"0.0.0.0\"" >> $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
# echo "peer: \"$ipAddr\"" >> $configFile
# peer: ["要连接的peerid"]
......@@ -292,7 +326,7 @@ sentryConfig="app.json"
echo "{" > $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 "\"main_account_priv\": \"F53D987FB2E98107A6AD7916AA8C6FF65F9C19D3F703AF7540002357ECAB69A1\"" >> $sentryConfig
echo "}" >> $sentryConfig
......@@ -411,10 +445,10 @@ echo "" >> $composefile
if [ $i -eq 1 ]; then
#echo "p2p-priv-key: \"/etc/MetaNet/default-priv-key\"" >> $configFile
echo "" >> $composefile
else
# if [ $i -eq 1 ]; then
# #echo "p2p-priv-key: \"/etc/MetaNet/default-priv-key\"" >> $configFile
# echo "" >> $composefile
# else
echo " nebula:" >> $composefile
echo " image: caduceus/cmp2-test-net-meta-nebula:v0.0.13" >> $composefile
echo " container_name: nebula" >> $composefile
......@@ -430,7 +464,7 @@ else
echo " networks:" >> $composefile
echo " - meta" >> $composefile
echo "" >> $composefile
fi
#fi
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