Skip to content

Commit

Permalink
Add app versions to mynode_config.sh so they can be read by any script
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellCash committed Mar 19, 2020
1 parent d9788ef commit e3cedcc
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 21 deletions.
13 changes: 4 additions & 9 deletions rootfs/standard/usr/bin/mynode_post_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ usermod -aG docker root

# Upgrade BTC
echo "Upgrading BTC..."
BTC_VERSION="0.19.1"
ARCH="UNKNOWN"
if [ $IS_RASPI = 1 ]; then
ARCH="arm-linux-gnueabihf"
Expand All @@ -103,9 +102,9 @@ else
echo "Unknown Bitcoin Version"
exit 1
fi
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/bitcoin-$BTC_VERSION-$ARCH.tar.gz
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$ARCH.tar.gz
BTC_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btc_url
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/SHA256SUMS.asc
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/SHA256SUMS.asc
CURRENT=""
if [ -f $BTC_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $BTC_UPGRADE_URL_FILE)
Expand All @@ -124,8 +123,8 @@ if [ "$CURRENT" != "$BTC_UPGRADE_URL" ]; then
gpg --verify SHA256SUMS.asc
if [ $? == 0 ]; then
# Install Bitcoin
tar -xvf bitcoin-$BTC_VERSION-$ARCH.tar.gz
mv bitcoin-$BTC_VERSION bitcoin
tar -xvf bitcoin-$BITCOIND_VERSION-$ARCH.tar.gz
mv bitcoin-$BITCOIND_VERSION bitcoin
install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*

# Mark current version
Expand All @@ -140,7 +139,6 @@ fi

# Upgrade LND
echo "Upgrading LND..."
LND_VERSION="v0.9.2-beta"
LND_ARCH="lnd-linux-armv7"
if [ $IS_X86 = 1 ]; then
LND_ARCH="lnd-linux-amd64"
Expand Down Expand Up @@ -179,7 +177,6 @@ fi

# Upgrade Loop
echo "Upgrading loopd..."
LOOP_VERSION="v0.5.1-beta"
LOOP_ARCH="loop-linux-armv7"
if [ $IS_X86 = 1 ]; then
LOOP_ARCH="loop-linux-amd64"
Expand Down Expand Up @@ -217,7 +214,6 @@ if [ "$CURRENT" != "$LOOP_UPGRADE_URL" ]; then
fi

# Install LndHub
LNDHUB_VERSION="v1.1.3"
LNDHUB_UPGRADE_URL=https://github.com/BlueWallet/LndHub/archive/${LNDHUB_VERSION}.tar.gz
LNDHUB_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lndhub_url
CURRENT=""
Expand Down Expand Up @@ -310,7 +306,6 @@ fi


# Upgrade RTL
RTL_VERSION="v0.6.8"
RTL_UPGRADE_URL=https://github.com/Ride-The-Lightning/RTL/archive/$RTL_VERSION.tar.gz
RTL_UPGRADE_ASC_URL=https://github.com/Ride-The-Lightning/RTL/releases/download/$RTL_VERSION/$RTL_VERSION.tar.gz.asc
RTL_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.rtl_url
Expand Down
9 changes: 8 additions & 1 deletion rootfs/standard/usr/share/mynode/mynode_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ if [[ "$SERIAL_NUM" == "" ]]; then
SERIAL_NUM=$(sudo dmidecode | grep UUID | cut -d ' ' -f 2)
fi

# Appplication versions
readonly BITCOIND_VERSION="0.19.1"
readonly LND_VERSION="v0.9.2-beta"
readonly LNDHUB_VERSION="v1.1.3"
readonly LOOP_VERSION="v0.5.1-beta"
readonly RTL_VERSION="v0.6.8"

# Set all default / standard bash config settings
MYNODE_DIR=/mnt/hdd/mynode
VPN_BACKUP_DIR=/mnt/hdd/mynode/vpn
Expand Down Expand Up @@ -97,4 +104,4 @@ if [ -f /usr/share/mynode/mynode_config_raspi.sh ]; then
fi
if [ -f /usr/share/mynode/mynode_config_debian.sh ]; then
source /usr/share/mynode/mynode_config_debian.sh
fi
fi
1 change: 1 addition & 0 deletions scripts/setup_new_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
1 change: 1 addition & 0 deletions scripts/setup_new_other.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
1 change: 1 addition & 0 deletions scripts/setup_new_raspi3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
1 change: 1 addition & 0 deletions scripts/setup_new_raspi4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
1 change: 1 addition & 0 deletions scripts/setup_new_rock64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
1 change: 1 addition & 0 deletions scripts/setup_new_rockpro64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ echo "Step 3: "
echo " Login to device with username 'admin' and password 'bolt'"
echo " Run the following commands. Use bolt at password prompts."
echo " wget http://${LOCAL_IP}:8000/setup_device.sh -O setup_device.sh"
echo " wget http://${LOCAL_IP}:8000/usr/share/mynode/mynode_config.sh -O mynode_config.sh"
echo " chmod +x setup_device.sh"
echo " tmux new-session -s mynode sudo ./setup_device.sh ${LOCAL_IP}"
echo ""
Expand Down
18 changes: 7 additions & 11 deletions setup/setup_device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Run with "sudo"
###

source ~/mynode_config.sh

set -x
set -e

Expand Down Expand Up @@ -202,7 +204,6 @@ rm -rf /etc/update-motd.d/*


# Install Bitcoin
BTC_VERSION="0.19.1"
ARCH="UNKNOWN"
if [ $IS_RASPI = 1 ]; then
ARCH="arm-linux-gnueabihf"
Expand All @@ -214,9 +215,9 @@ else
echo "Unknown Bitcoin Version"
exit 1
fi
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/bitcoin-$BTC_VERSION-$ARCH.tar.gz
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$ARCH.tar.gz
BTC_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btc_url
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/SHA256SUMS.asc
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/SHA256SUMS.asc
CURRENT=""
if [ -f $BTC_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $BTC_UPGRADE_URL_FILE)
Expand All @@ -234,8 +235,8 @@ if [ "$CURRENT" != "$BTC_UPGRADE_URL" ]; then
gpg --verify SHA256SUMS.asc

# Install Bitcoin
tar -xvf bitcoin-$BTC_VERSION-$ARCH.tar.gz
mv bitcoin-$BTC_VERSION bitcoin
tar -xvf bitcoin-$BITCOIND_VERSION-$ARCH.tar.gz
mv bitcoin-$BITCOIND_VERSION bitcoin
install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*
if [ ! -L /home/bitcoin/.bitcoin ]; then
sudo -u bitcoin ln -s /mnt/hdd/mynode/bitcoin /home/bitcoin/.bitcoin
Expand All @@ -251,7 +252,6 @@ fi
cd ~

# Install Lightning
LND_VERSION="v0.9.2-beta"
LND_ARCH="lnd-linux-armv7"
if [ $IS_X86 = 1 ]; then
LND_ARCH="lnd-linux-amd64"
Expand Down Expand Up @@ -288,7 +288,6 @@ cd ~

# Install Loopd
echo "Upgrading loopd..."
LOOP_VERSION="v0.5.1-beta"
LOOP_ARCH="loop-linux-armv7"
if [ $IS_X86 = 1 ]; then
LOOP_ARCH="loop-linux-amd64"
Expand Down Expand Up @@ -332,7 +331,6 @@ chown -R bitcoin:bitcoin /opt/mynode


# Install LND Hub
LNDHUB_VERSION="v1.1.3"
LNDHUB_UPGRADE_URL=https://github.com/BlueWallet/LndHub/archive/${LNDHUB_VERSION}.tar.gz
LNDHUB_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lndhub_url
CURRENT=""
Expand Down Expand Up @@ -401,7 +399,6 @@ fi


# Install RTL
RTL_VERSION="v0.6.8"
RTL_UPGRADE_URL=https://github.com/Ride-The-Lightning/RTL/archive/$RTL_VERSION.tar.gz
RTL_UPGRADE_ASC_URL=https://github.com/Ride-The-Lightning/RTL/releases/download/$RTL_VERSION/$RTL_VERSION.tar.gz.asc
RTL_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.rtl_url
Expand Down Expand Up @@ -580,6 +577,7 @@ rm -rf /root/.ssh/known_hosts
rm -rf /etc/resolv.conf
rm -rf /tmp/*
rm -rf ~/setup_device.sh
rm -rf ~/mynode_config.sh
rm -rf /etc/motd # Remove simple motd for update-motd.d

# Reset MAC address for Armbian devices
Expand Down Expand Up @@ -607,5 +605,3 @@ echo ""
### MAKE IMAGE NOW ###
# This prevents auto gen files like certs to be part of the base image
# Must make sure image can boot after this point and fully come up


0 comments on commit e3cedcc

Please sign in to comment.