2019-06-15 23:02:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source /usr/share/mynode/mynode_config.sh
|
|
|
|
|
2019-07-28 23:34:08 +00:00
|
|
|
set -x
|
|
|
|
|
|
|
|
# Shut down main services to save memory and CPU
|
|
|
|
systemctl stop electrs
|
2019-08-10 01:07:46 +00:00
|
|
|
systemctl stop lnd
|
2019-07-28 23:34:08 +00:00
|
|
|
systemctl stop quicksync
|
2019-08-10 01:07:46 +00:00
|
|
|
systemctl stop bitcoind
|
2019-07-28 23:34:08 +00:00
|
|
|
|
2019-06-15 23:02:44 +00:00
|
|
|
# Install any new software
|
2019-09-25 01:54:38 +00:00
|
|
|
apt -y install pv sysstat network-manager
|
2019-06-15 23:02:44 +00:00
|
|
|
|
|
|
|
# Install any pip software
|
2019-08-08 01:46:58 +00:00
|
|
|
pip install tzupdate
|
|
|
|
|
2019-06-15 23:02:44 +00:00
|
|
|
|
2019-08-18 03:30:21 +00:00
|
|
|
# Install any pip3 software
|
|
|
|
pip3 install python-bitcointx
|
|
|
|
|
2019-06-15 23:02:44 +00:00
|
|
|
# Upgrade BTC
|
|
|
|
ARCH="arm-linux-gnueabihf"
|
|
|
|
uname -a | grep aarch64
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
ARCH="aarch64-linux-gnu"
|
|
|
|
fi
|
2019-08-10 01:07:46 +00:00
|
|
|
BTC_UPGRADE_URL=https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-$ARCH.tar.gz
|
2019-06-15 23:02:44 +00:00
|
|
|
BTC_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btc_url
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $BTC_UPGRADE_URL_FILE ]; then
|
|
|
|
CURRENT=$(cat $BTC_UPGRADE_URL_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$BTC_UPGRADE_URL" ]; then
|
|
|
|
# Download and install Bitcoin
|
|
|
|
rm -rf /tmp/bitcoin*
|
|
|
|
cd /tmp
|
|
|
|
wget $BTC_UPGRADE_URL -O bitcoin.tar.gz
|
|
|
|
tar -xvf bitcoin.tar.gz
|
|
|
|
mv bitcoin-* bitcoin
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $BTC_UPGRADE_URL > $BTC_UPGRADE_URL_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Upgrade LND
|
2019-08-01 01:51:58 +00:00
|
|
|
LND_UPGRADE_URL=https://github.com/lightningnetwork/lnd/releases/download/v0.7.1-beta/lnd-linux-armv7-v0.7.1-beta.tar.gz
|
2019-06-15 23:02:44 +00:00
|
|
|
LND_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lnd_url
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $LND_UPGRADE_URL_FILE ]; then
|
|
|
|
CURRENT=$(cat $LND_UPGRADE_URL_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$LND_UPGRADE_URL" ]; then
|
|
|
|
# Download and install LND
|
|
|
|
rm -rf /tmp/lnd*
|
|
|
|
cd /tmp
|
|
|
|
wget $LND_UPGRADE_URL -O lnd.tar.gz
|
|
|
|
tar -xzf lnd.tar.gz
|
|
|
|
mv lnd-* lnd
|
|
|
|
install -m 0755 -o root -g root -t /usr/local/bin lnd/*
|
|
|
|
|
|
|
|
# Mark current version
|
|
|
|
echo $LND_UPGRADE_URL > $LND_UPGRADE_URL_FILE
|
|
|
|
fi
|
|
|
|
|
2019-07-28 22:41:37 +00:00
|
|
|
# Upgrade RTL
|
|
|
|
RTL_UPGRADE_URL=https://github.com/ShahanaFarooqui/RTL/archive/v0.4.4.tar.gz
|
|
|
|
RTL_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.rtl_url
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $RTL_UPGRADE_URL_FILE ]; then
|
|
|
|
CURRENT=$(cat $RTL_UPGRADE_URL_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$RTL_UPGRADE_URL" ]; then
|
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf RTL
|
|
|
|
sudo -u bitcoin wget $RTL_UPGRADE_URL -O RTL.tar.gz
|
|
|
|
sudo -u bitcoin tar -xvf RTL.tar.gz
|
|
|
|
sudo -u bitcoin rm RTL.tar.gz
|
|
|
|
sudo -u bitcoin mv RTL-* RTL
|
|
|
|
cd RTL
|
2019-08-15 02:41:38 +00:00
|
|
|
sudo -u bitcoin NG_CLI_ANALYTICS=false npm install
|
2019-07-28 22:41:37 +00:00
|
|
|
|
|
|
|
mkdir -p /home/bitcoin/.mynode/
|
|
|
|
chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
|
|
|
|
echo $RTL_UPGRADE_URL > $RTL_UPGRADE_URL_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Upgrade LND Admin
|
|
|
|
LNDADMIN_UPGRADE_URL=https://github.com/janoside/lnd-admin/archive/v0.10.12.tar.gz
|
|
|
|
LNDADMIN_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lndadmin_url
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $LNDADMIN_UPGRADE_URL_FILE ]; then
|
|
|
|
CURRENT=$(cat $LNDADMIN_UPGRADE_URL_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$LNDADMIN_UPGRADE_URL" ]; then
|
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf lnd-admin
|
|
|
|
sudo -u bitcoin wget $LNDADMIN_UPGRADE_URL -O lnd-admin.tar.gz
|
|
|
|
sudo -u bitcoin tar -xvf lnd-admin.tar.gz
|
|
|
|
sudo -u bitcoin rm lnd-admin.tar.gz
|
|
|
|
sudo -u bitcoin mv lnd-* lnd-admin
|
|
|
|
cd lnd-admin
|
|
|
|
sudo -u bitcoin npm install
|
|
|
|
|
|
|
|
mkdir -p /home/bitcoin/.mynode/
|
|
|
|
chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
|
|
|
|
echo $LNDADMIN_UPGRADE_URL > $LNDADMIN_UPGRADE_URL_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Upgrade Bitcoin RPC Explorer
|
|
|
|
BTCRPCEXPLORER_UPGRADE_URL=https://github.com/janoside/btc-rpc-explorer/archive/v1.0.3.tar.gz
|
|
|
|
BTCRPCEXPLORER_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btcrpcexplorer_url
|
|
|
|
CURRENT=""
|
|
|
|
if [ -f $BTCRPCEXPLORER_UPGRADE_URL_FILE ]; then
|
|
|
|
CURRENT=$(cat $BTCRPCEXPLORER_UPGRADE_URL_FILE)
|
|
|
|
fi
|
|
|
|
if [ "$CURRENT" != "$BTCRPCEXPLORER_UPGRADE_URL" ]; then
|
|
|
|
cd /opt/mynode
|
|
|
|
rm -rf btc-rpc-explorer
|
|
|
|
sudo -u bitcoin wget $BTCRPCEXPLORER_UPGRADE_URL -O btc-rpc-explorer.tar.gz
|
|
|
|
sudo -u bitcoin tar -xvf btc-rpc-explorer.tar.gz
|
|
|
|
sudo -u bitcoin rm btc-rpc-explorer.tar.gz
|
|
|
|
sudo -u bitcoin mv btc-rpc-* btc-rpc-explorer
|
|
|
|
cd btc-rpc-explorer
|
|
|
|
sudo -u bitcoin npm install
|
|
|
|
|
|
|
|
mkdir -p /home/bitcoin/.mynode/
|
|
|
|
chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
|
|
|
|
echo $BTCRPCEXPLORER_UPGRADE_URL > $BTCRPCEXPLORER_UPGRADE_URL_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-06-15 23:02:44 +00:00
|
|
|
# Enable any new/required services
|
2019-09-16 23:46:20 +00:00
|
|
|
systemctl enable firewall
|
2019-09-24 01:50:19 +00:00
|
|
|
systemctl enable invalid_block_check
|
2019-06-15 23:02:44 +00:00
|
|
|
|
2019-09-17 03:23:34 +00:00
|
|
|
# Disable any old services
|
|
|
|
sudo systemctl disable hitch
|
|
|
|
sudo systemctl disable mongodb
|
|
|
|
|
2019-06-15 23:02:44 +00:00
|
|
|
# Reload service settings
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
|
|
|
# Sync FS
|
|
|
|
sync
|