forked from buzzkillb/d-fortunastake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcn.sh
212 lines (179 loc) · 6.6 KB
/
cn.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/sh
TEMP=/tmp/answer$$
whiptail --title "Innova [INN]" --menu "CollateralNode :" 20 0 0 1 "Install Innova CollateralNode Ubuntu 16.04" 2 "Install Innova CollateralNode Ubuntu 18.04" 3 "Update Innova CollateralNode Ubuntu 16.04" 4 "Watch innovad getinfo <ctrl+c> to exit" 2>$TEMP
choice=`cat $TEMP`
case $choice in
1) echo 1 "Installing Innova CollateralNode Ubuntu 16.04"
echo "Updating linux packages"
sudo apt-get update -y && sudo apt-get upgrade -y
echo "Installing git"
sudo apt install git -y
echo "Installing curl"
sudo apt-get install curl -y
echo "Intalling fail2ban"
sudo apt install fail2ban -y
echo "Installing Firewall"
sudo apt install ufw -y
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow 14530/tcp
sudo ufw allow 14539/tcp
sudo ufw logging on
sudo ufw --force enable
echo "Installing PWGEN"
sudo apt-get install -y pwgen
echo "Installing 2G Swapfile"
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo "Installing Dependencies"
sudo apt-get install -y git unzip build-essential libssl-dev libdb++-dev libboost-all-dev libqrencode-dev libminiupnpc-dev libgmp-dev libevent-dev autogen automake libtool libcurl4-openssl-dev
echo "Downloading Innova Wallet"
wget https://github.com/innova-foundation/innova/releases/download/v4.3.8.9/innovad
cp -rf innovad /usr/bin/innovad
#tar -xvf innovad-v3.2.5-ubuntu1604.tar.gz -C /usr/local/bin
#rm innovad-v3.2.5-ubuntu1604.tar.gz
echo "Installing Innova Wallet"
git clone https://github.com/innova-foundation/innova
cd innova
git pull
git checkout master
git pull
cd src
make -f makefile.unix
strip innovad
sudo mv ~/innova/src/innovad /usr/local/bin/innovad
echo "Populate innova.conf"
mkdir ~/.innova
# Get VPS IP Address
VPSIP=$(curl ipinfo.io/ip)
# create rpc user and password
rpcuser=$(openssl rand -base64 24)
# create rpc password
rpcpassword=$(openssl rand -base64 48)
echo -n "What is your collateralnodeprivkey? (Hint:genkey output)"
read COLLATERALNODEPRIVKEY
echo -e "rpcuser=$rpcuser\nrpcpassword=$rpcpassword\nserver=1\nlisten=1\ndaemon=1\nport=14539\naddnode=innseeder.circuitbreaker.online\naddnodeinnseeder.circuitbreaker.dev\naddnode=innseeder.innovai.cloud\nrpcallowip=127.0.0.1\nexternalip=$VPSIP:14539\ncollateralnode=1\ncollateralnodeprivkey=$COLLATERALNODEPRIVKEY" > ~/.innova/innova.conf
#echo "Get Chaindata"
#sudo apt-get -y install unzip
#cd ~/.innova
#rm -rf database txleveldb smsgDB
#wget https://github.com/innova-foundation/innova/releases/download/v4.3.8.8/innovabootstrap.zip
#unzip innovabootstrap.zip
#rm innovabootstrap.zip
echo "Add Daemon Cronjob"
(crontab -l ; echo "@reboot /usr/local/bin/innovad")| crontab -
#(crontab -l ; echo "0 * * * * /usr/local/bin/innovad stop")| crontab -
#(crontab -l ; echo "2 * * * * /usr/local/bin/innovad")| crontab -
echo "Starting Innova Daemon"
innovad
echo "Watch getinfo for block sync"
watch -n 10 'innovad getinfo'
;;
2) echo 2 "Installing Innova CollateralNode Ubuntu 18.04"
echo "Updating linux packages"
sudo apt-get update -y && sudo apt-get upgrade -y
echo "Installing git"
sudo apt install git -y
echo "Installing curl"
sudo apt-get install curl -y
echo "Intalling fail2ban"
sudo apt install fail2ban -y
echo "Installing Firewall"
sudo apt install ufw -y
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow 14530/tcp
sudo ufw allow 14539/tcp
sudo ufw logging on
sudo ufw --force enable
echo "Installing PWGEN"
sudo apt-get install -y pwgen
echo "Installing 2G Swapfile"
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo "Installing Dependencies"
sudo apt-get install -y git unzip build-essential libdb++-dev libboost-all-dev libqrencode-dev libminiupnpc-dev libgmp-dev libevent-dev autogen automake libtool libcurl4-openssl-dev
echo "Downgrade libssl-dev"
sudo apt-get install make
wget https://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz
tar -xzvf openssl-1.0.1j.tar.gz
cd openssl-1.0.1j
./config
make depend
make
sudo make install
sudo ln -sf /usr/local/ssl/bin/openssl `which openssl`
cd ~
openssl version -v
echo "Downloading Innova Wallet"
wget https://github.com/innova-foundation/innova/releases/download/v4.3.8.9/innovad
cp -rf innovad /usr/bin/innovad
#tar -xvf innovad-v3.2.5-ubuntu1604.tar.gz -C /usr/local/bin
#rm innovad-v3.2.5-ubuntu1604.tar.gz
echo "Installing Innova Wallet"
git clone https://github.com/innova-foundation/innova
cd innova
git pull
git checkout master
git pull
cd src
OPENSSL_INCLUDE_PATH=/usr/local/ssl/include OPENSSL_LIB_PATH=/usr/local/ssl/lib make -f makefile.unix
strip innovad
sudo mv ~/innova/src/innovad /usr/local/bin/innovad
echo "Populate innova.conf"
mkdir ~/.innova
# Get VPS IP Address
VPSIP=$(curl ipinfo.io/ip)
# create rpc user and password
rpcuser=$(openssl rand -base64 24)
# create rpc password
rpcpassword=$(openssl rand -base64 48)
echo -n "What is your collateralnodeprivkey? (Hint:genkey output)"
read COLLATERALNODEPRIVKEY
echo -e "rpcuser=$rpcuser\nrpcpassword=$rpcpassword\nserver=1\nlisten=1\ndaemon=1\nport=14539\naddnode=innseeder.circuitbreaker.online\naddnodeinnseeder.circuitbreaker.dev\naddnode=innseeder.innovai.cloud\nrpcallowip=127.0.0.1\nexternalip=$VPSIP:14539\ncollateralnode=1\ncollateralnodeprivkey=$COLLATERALNODEPRIVKEY" > ~/.innova/innova.conf
echo "Get Chaindata"
sudo apt-get -y install unzip
cd ~/.innova
rm -rf database txleveldb smsgDB
wget wget https://github.com/innova-foundation/innova/releases/download/v4.3.8.8/innovabootstrap.zip
unzip innovabootstrap.zip
rm innovabootstrap.zip
echo "Add Daemon Cronjob"
(crontab -l ; echo "@reboot /usr/local/bin/innovad")| crontab -
#(crontab -l ; echo "0 * * * * /usr/local/bin/innovad stop")| crontab -
#(crontab -l ; echo "2 * * * * /usr/local/bin/innovad")| crontab -
echo "Starting Innova Daemon"
innovad
echo "Watch getinfo for block sync"
watch -n 10 'innovad getinfo'
;;
3) echo 3 "Updating Innova CollateralNode"
echo "Stop innovad"
innovad stop
cd innova
git pull
git checkout master
git pull
cd src
make -f makefile.unix
strip innovad
sudo mv ~/innova/src/innovad /usr/local/bin/innovad
echo "Start innovad"
innovad
watch -n 10 'innovad getinfo'
;;
4) echo 4 "Watch innovad getinfo"
watch -n 10 'innovad getinfo'
;;
esac
echo Selected $choice