This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
forked from getminera/minera
-
Notifications
You must be signed in to change notification settings - Fork 1
/
upgrade_raspinode.sh
executable file
·55 lines (40 loc) · 2.2 KB
/
upgrade_raspinode.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
# This is the upgrade script for RaspiNode https://github.com/piratecash/raspinode
# This script, as RaspiNode, is intended to be used on a Debian-like system
echo -e "-----\nSTART RaspiNode Upgrade script\n-----\n"
echo -e "-----\nInstall extra packages\n-----\n"
apt-get update
apt -y upgrade
apt-get -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install build-essential libtool libncurses5-dev autoconf automake redis-server php7.0-cli php7.0-curl php7.0-fpm php7.0-readline php7.0-json shellinabox nginx-light libboost-all-dev libqrencode-dev dh-autoreconf libminiupnpc-dev libgmp-dev libevent-dev python-requests libdb++-dev pwgen python3-pip
sudo dpkg --configure -a
pip3 install pyfiglet
echo -e "Upgrading sudoers configuration for www-data and minera users\n-----\n"
if ! grep -q 'www-data ALL = (ALL) NOPASSWD: ALL' '/etc/sudoers'; then
echo -e "www-data ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
fi
if ! grep -q 'pirate ALL = (ALL) NOPASSWD: ALL' '/etc/sudoers'; then
echo -e "pirate ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
fi
echo -e "Configuring shellinabox\n-----\n"
sudo cp conf/shellinabox /etc/default/
sudo service shellinabox restart
echo -e "Changing cron file\n-----\n"
echo -e "*/1 * * * * www-data php `pwd`/index.php app cron" > /etc/cron.d/raspinode
echo -e "* * * * * root python3 /var/www/raspinode/lcd.py > /dev/tty1" > /etc/cron.d/lcd
echo -e "Adding groups to pirate\n-----\n"
usermod -a -G dialout,plugdev,tty,www-data pirate
echo -e "Update redis values\n-----\n"
redis-cli del raspinode_update
redis-cli del raspinode_version
redis-cli del altcoins_update
redis-cli del dashboard_coin_rates
echo -e "Update piratecashd\n-----\n"
su - pirate -c "/usr/local/bin/piratecashd stop"
sleep 10
rm -f /tmp/raspberry-piratecashd*
wget https://github.com/piratecash/piratecash/releases/download/v11.6.2/raspberry-piratecashd.tar.gz -O /tmp/raspberry-piratecashd.tar.gz
killall -9 piratecashd
rm /usr/local/bin/piratecashd
tar xf /tmp/raspberry-piratecashd.tar.gz -C /usr/local/bin/
su - pirate -c "/usr/local/bin/piratecashd"
echo -e 'DONE! RaspiNode is ready!\n\nOpen the URL: http://'$(hostname -I | tr -d ' ')'/raspinode/\n\nAnd happy staking!\n'