-
Notifications
You must be signed in to change notification settings - Fork 1
/
old-node2.sh
68 lines (67 loc) · 2.79 KB
/
old-node2.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
#!/bin/bash
clear
echo "Welcome to Ubiq!"
echo
echo "When Raspbian configurator opens, change password for user "pi" & set your timezone in localization options."
echo
echo "You will be asked to set a password for the new user called 'node'."
echo
echo "When setup is finished your node will restart automatically."
echo
sleep 15s
sudo raspi-config
sudo adduser node
sudo usermod -G sudo node
sudo apt-get update -q
sudo apt-get upgrade -y -q
sudo apt-get dist-upgrade -q
sudo apt-get autoremove -y -q
sudo apt-get install ntp -y -q
sudo apt-get install htop -q
sudo apt-get install supervisor -y -q
sudo sed -i -e "s/CONF_SWAPSIZE=100/CONF_SWAPSIZE=2048/" /etc/dphys-swapfile
sudo touch /etc/supervisor/conf.d/gubiq.conf
echo "[program:gubiq]" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "command=/usr/bin/gubiq --verbosity 3 --rpc --rpcaddr "127.0.0.1" --rpcport "8588" --rpcapi "eth,net,web3" --maxpeers 100 --ethstats "temporary:[email protected]"" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "user=node" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "autostart=true" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "autorestart=true" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "stderr_logfile=/var/log/gubiq.err.log" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo "stdout_logfile=/var/log/gubiq.out.log" | sudo tee -a /etc/supervisor/conf.d/gubiq.conf
echo
echo
echo "Type a name for your node to be displayed on the Network Stats website, then press Enter."
echo
read varname
sudo sed -i -e "s/temporary/$varname/" /etc/supervisor/conf.d/gubiq.conf
echo
echo "Your node will be named $varname"
echo
sleep 4
echo "Enter the secret to list your node on the Ubiq Stats Page, then press Enter."
echo
read varpass
sudo sed -i -e "s/password/$varpass/" /etc/supervisor/conf.d/gubiq.conf
echo
read -p "Would you like to set your node to "full" sync mode? This will take more storage space and sync will take longer. (y/n)" CONT
if [ "$CONT" = "y" ]; then
sudo sed -i -e "s/--maxpeers 100/--maxpeers 100 --syncmode "full" --gcmode "archive"/" /etc/supervisor/conf.d/gubiq.conf
echo "Your node will sync in 'full' mode"
sleep 4s
else
echo "Your node will sync in 'fast' mode"
sleep 4s
fi
wget https://raw.githubusercontent.com/maaatttt/ubiq/master/auto.sh
sudo chmod +x auto.sh
read -p "Would you like to allow your node to auto-fetch the gubiq binaries once per month? This will keep your node on the latest release without your interaction. (y/n)" CONT
if [ "$CONT" = "y" ]; then
echo "@monthly ./auto.sh" | crontab -
else
echo "Your node will not automatically update gubiq. Updates must be handled manually."
sleep 4
fi
wget https://github.com/ubiq/go-ubiq/releases/download/v3.1.0/gubiq-linux-arm-7
sudo cp ./gubiq-linux-arm-7 /usr/bin/gubiq
sudo chmod +x /usr/bin/gubiq
sudo reboot