forked from wormholes-org/wormholes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wormholes_install.sh
55 lines (50 loc) · 1.8 KB
/
wormholes_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#check docker cmd
which docker >/dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "docker not found, please install first!"
echo "ubuntu:sudo apt install docker.io -y"
echo "centos:yum install -y docker-ce "
echo "fedora:sudo dnf install -y docker-ce"
exit
fi
#check docker service
docker ps > /dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "docker service is not running! you can use command start it:"
echo "sudo service docker start"
exit
fi
docker stop wormholes > /dev/null 2>&1
docker rm wormholes > /dev/null 2>&1
docker rmi wormholestech/wormholes:v1 > /dev/null 2>&1
if [ -d /wm/.wormholes/wormholes ]; then
read -p "If you want to clear the historical data of the wormholes blockchain, please press y to clear it, if not, please press Enter directly:" xyz
if [ "$xyz" = 'y' ];then
cp /wm/.wormholes/wormholes/nodekey /wm/nodekey
rm -rf /wm/.wormholes
mkdir -p /wm/.wormholes/wormholes
mv /wm/nodekey /wm/.wormholes/wormholes/nodekey
else
echo "not empty"
fi
else
read -p "Please enter your private key:" ky
fi
if [ -n "$ky" ]; then
if [ ${#ky} -eq 64 ];then
mkdir -p /wm/.wormholes/wormholes
echo $ky > /wm/.wormholes/wormholes/nodekey
elif [ ${#ky} -eq 66 ] && ([ ${ky:0:2} == "0x" ] || [ ${ky:0:2} == "0X" ]);then
mkdir -p /wm/.wormholes/wormholes
echo ${ky:2:64} > /wm/.wormholes/wormholes/nodekey
else
echo "the nodekey format is not correct"
exit -1
fi
fi
docker run -id -e KEY=$ky -p 30303:30303 -p 8545:8545 -v /wm/.wormholes:/wm/.wormholes --name wormholes wormholestech/wormholes:v1
echo "Your private key is:"
sleep 6
docker exec -it wormholes /usr/bin/cat /wm/.wormholes/wormholes/nodekey
#cat /wm/.wormholes/geth/nodekey