From d09b41262decbe6f2d59fe0e0d58967042706283 Mon Sep 17 00:00:00 2001 From: MitchellCash Date: Tue, 10 Mar 2020 09:14:53 +0000 Subject: [PATCH] Add app versions to mynode_config.sh so they can be read by any script --- rootfs/standard/usr/bin/mynode_post_upgrade.sh | 13 ++++--------- .../standard/usr/share/mynode/mynode_config.sh | 9 ++++++++- scripts/setup_new_debian.sh | 3 ++- scripts/setup_new_other.sh | 1 + scripts/setup_new_raspi3.sh | 3 ++- scripts/setup_new_raspi4.sh | 3 ++- scripts/setup_new_rock64.sh | 3 ++- scripts/setup_new_rockpro64.sh | 3 ++- setup/setup_device.sh | 18 +++++++----------- 9 files changed, 30 insertions(+), 26 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index e7156574b..35b117785 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -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" @@ -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) @@ -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 @@ -140,7 +139,6 @@ fi # Upgrade LND echo "Upgrading LND..." -LND_VERSION="v0.9.0-beta" LND_ARCH="lnd-linux-armv7" if [ $IS_X86 = 1 ]; then LND_ARCH="lnd-linux-amd64" @@ -179,7 +177,6 @@ fi # Upgrade Loopd echo "Upgrading loopd..." -LOOP_VERSION="v0.5.0-beta" LOOP_ARCH="loop-linux-armv7" if [ $IS_X86 = 1 ]; then LOOP_ARCH="loop-linux-amd64" @@ -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="" @@ -310,7 +306,6 @@ fi # Upgrade RTL -RTL_VERSION="v0.6.7" 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 diff --git a/rootfs/standard/usr/share/mynode/mynode_config.sh b/rootfs/standard/usr/share/mynode/mynode_config.sh index e616b61d0..45ada12db 100644 --- a/rootfs/standard/usr/share/mynode/mynode_config.sh +++ b/rootfs/standard/usr/share/mynode/mynode_config.sh @@ -43,6 +43,13 @@ if [[ "$SERIAL_NUM" == "" ]]; then SERIAL_NUM=$(sudo dmidecode | grep UUID | cut -d ' ' -f 2) fi +# Appplication versions +readonly BICOIND_VERSION="0.19.1" +readonly LND_VERSION="v0.9.0-beta" +readonly LNDHUB_VERSION="v1.1.3" +readonly LOOP_VERSION="v0.5.0-beta" +readonly RTL_VERSION="v0.6.7" + # Set all default / standard bash config settings MYNODE_DIR=/mnt/hdd/mynode VPN_BACKUP_DIR=/mnt/hdd/mynode/vpn @@ -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 \ No newline at end of file +fi diff --git a/scripts/setup_new_debian.sh b/scripts/setup_new_debian.sh index 9f4deaade..4147e52f2 100755 --- a/scripts/setup_new_debian.sh +++ b/scripts/setup_new_debian.sh @@ -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 "" @@ -45,4 +46,4 @@ echo "Congratulations! Your device is now ready!" echo " Access it via a web browser at http://mynode.local/ or http:///" echo " Access it via SSH using the default credentials: admin / bolt" echo " You should change your password on the settings page in the web GUI" -echo "" \ No newline at end of file +echo "" diff --git a/scripts/setup_new_other.sh b/scripts/setup_new_other.sh index 2d92d4426..b4a19dd22 100755 --- a/scripts/setup_new_other.sh +++ b/scripts/setup_new_other.sh @@ -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 "" diff --git a/scripts/setup_new_raspi3.sh b/scripts/setup_new_raspi3.sh index 43447c223..e54455551 100755 --- a/scripts/setup_new_raspi3.sh +++ b/scripts/setup_new_raspi3.sh @@ -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 "" @@ -46,4 +47,4 @@ echo "Congratulations! Your device is now ready!" echo " Access it via a web browser at http://mynode.local/ or http:///" echo " Access it via SSH using the default credentials: admin / bolt" echo " You should change your password on the settings page in the web GUI" -echo "" \ No newline at end of file +echo "" diff --git a/scripts/setup_new_raspi4.sh b/scripts/setup_new_raspi4.sh index eca3ec63a..f1432d4a3 100755 --- a/scripts/setup_new_raspi4.sh +++ b/scripts/setup_new_raspi4.sh @@ -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 "" @@ -46,4 +47,4 @@ echo "Congratulations! Your device is now ready!" echo " Access it via a web browser at http://mynode.local/ or http:///" echo " Access it via SSH using the default credentials: admin / bolt" echo " You should change your password on the settings page in the web GUI" -echo "" \ No newline at end of file +echo "" diff --git a/scripts/setup_new_rock64.sh b/scripts/setup_new_rock64.sh index b776adfaa..6acf17606 100755 --- a/scripts/setup_new_rock64.sh +++ b/scripts/setup_new_rock64.sh @@ -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 "" @@ -46,4 +47,4 @@ echo "Congratulations! Your device is now ready!" echo " Access it via a web browser at http://mynode.local/ or http:///" echo " Access it via SSH using the default credentials: admin / bolt" echo " You should change your password on the settings page in the web GUI" -echo "" \ No newline at end of file +echo "" diff --git a/scripts/setup_new_rockpro64.sh b/scripts/setup_new_rockpro64.sh index 4960a9610..b549b60dd 100755 --- a/scripts/setup_new_rockpro64.sh +++ b/scripts/setup_new_rockpro64.sh @@ -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 "" @@ -46,4 +47,4 @@ echo "Congratulations! Your device is now ready!" echo " Access it via a web browser at http://mynode.local/ or http:///" echo " Access it via SSH using the default credentials: admin / bolt" echo " You should change your password on the settings page in the web GUI" -echo "" \ No newline at end of file +echo "" diff --git a/setup/setup_device.sh b/setup/setup_device.sh index cb2911ea3..30d54e893 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -5,6 +5,8 @@ ### Run with "sudo" ### +source ~/mynode_config.sh + set -x set -e @@ -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" @@ -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) @@ -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 @@ -251,7 +252,6 @@ fi cd ~ # Install Lightning -LND_VERSION="v0.9.0-beta" LND_ARCH="lnd-linux-armv7" if [ $IS_X86 = 1 ]; then LND_ARCH="lnd-linux-amd64" @@ -288,7 +288,6 @@ cd ~ # Install Loopd echo "Upgrading loopd..." -LOOP_VERSION="v0.5.0-beta" LOOP_ARCH="loop-linux-armv7" if [ $IS_X86 = 1 ]; then LOOP_ARCH="loop-linux-amd64" @@ -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="" @@ -401,7 +399,6 @@ fi # Install RTL -RTL_VERSION="v0.6.7" 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 @@ -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 @@ -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 - -