Merge pull request #1253 from 21isenough/add-bonus-zerotier

Add initial commit for bonus zerotier installation
This commit is contained in:
Christian Rotzoll
2020-06-23 18:51:59 +02:00
committed by GitHub
3 changed files with 95 additions and 14 deletions

View File

@@ -37,25 +37,25 @@ fi
# Put Activated Apps on top
if [ "${rtlWebinterface}" == "on" ]; then
OPTIONS+=(RTL "RTL Web Node Manager")
OPTIONS+=(RTL "RTL Web Node Manager")
fi
if [ "${BTCPayServer}" == "on" ]; then
OPTIONS+=(BTCPAY "BTCPay Server Info")
OPTIONS+=(BTCPAY "BTCPay Server Info")
fi
if [ "${ElectRS}" == "on" ]; then
OPTIONS+=(ELECTRS "Electrum Rust Server")
OPTIONS+=(ELECTRS "Electrum Rust Server")
fi
if [ "${BTCRPCexplorer}" == "on" ]; then
OPTIONS+=(EXPLORE "BTC RPC Explorer")
OPTIONS+=(EXPLORE "BTC RPC Explorer")
fi
if [ "${LNBits}" == "on" ]; then
OPTIONS+=(LNBITS "LNbits Server")
fi
if [ "${lndmanage}" == "on" ]; then
OPTIONS+=(LNDMANAGE "LND Manage Script")
OPTIONS+=(LNDMANAGE "LND Manage Script")
fi
if [ "${loop}" == "on" ]; then
OPTIONS+=(LOOP "Loop In/Out Service")
OPTIONS+=(LOOP "Loop In/Out Service")
fi
if [ "${specter}" == "on" ]; then
OPTIONS+=(SPECTER "Cryptoadvance Specter")
@@ -69,10 +69,12 @@ fi
if [ "${bos}" == "on" ]; then
OPTIONS+=(BOS "Balance of Satoshis")
fi
if [ "${thunderhub}" == "on" ]; then
OPTIONS+=(THUB "ThunderHub")
fi
if [ "${zerotier}" == "on" ]; then
OPTIONS+=(ZEROTIER "ZeroTier")
fi
# Basic Options
OPTIONS+=(INFO "RaspiBlitz Status Screen")
@@ -84,7 +86,7 @@ OPTIONS+=(RECEIVE "Create Invoice/PaymentRequest")
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | jq '.[] | length')
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
OPTIONS+=(CLOSEALL "Close all open Channels")
OPTIONS+=(CLOSEALL "Close all open Channels")
fi
OPTIONS+=(CASHOUT "Remove Funds from LND")
@@ -92,7 +94,7 @@ OPTIONS+=(CASHOUT "Remove Funds from LND")
if [ "${chain}" = "main" ]; then
OPTIONS+=(lnbalance "Detailed Wallet Balances")
OPTIONS+=(lnchannels "Lightning Channel List")
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
fi
OPTIONS+=(SETTINGS "Node Settings & Options")
@@ -104,11 +106,11 @@ OPTIONS+=(NAME "Change Name/Alias of Node")
OPTIONS+=(PASSWORD "Change Passwords")
if [ "${runBehindTor}" == "on" ]; then
OPTIONS+=(TOR "Monitor TOR Service")
OPTIONS+=(TOR "Monitor TOR Service")
fi
if [ "${touchscreen}" == "1" ]; then
OPTIONS+=(SCREEN "Touchscreen Calibration")
OPTIONS+=(SCREEN "Touchscreen Calibration")
fi
# final Options
@@ -182,6 +184,9 @@ case $CHOICE in
THUB)
sudo /home/admin/config.scripts/bonus.thunderhub.sh menu
;;
ZEROTIER)
sudo /home/admin/config.scripts/bonus.zerotier.sh menu
;;
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py
;;
@@ -200,7 +205,7 @@ case $CHOICE in
read key
;;
lnfwdreport)
./XXlnfwdreport.sh
./XXlnfwdreport.sh
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
@@ -272,7 +277,7 @@ case $CHOICE in
;;
UPDATE)
/home/admin/99updateMenu.sh
;;
;;
REBOOT)
clear
echo ""

View File

@@ -310,7 +310,7 @@ if [ "${thunderhub}" != "${choice}" ]; then
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
else
echo "ThunderHub setting unchanged."
fi

View File

@@ -0,0 +1,76 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to install, uninstall ZeroTier"
echo "bonus.zerotier.sh [on|off|menu]"
exit 1
fi
source /mnt/hdd/raspiblitz.conf
# add default value to raspi config if needed
if ! grep -Eq "^zerotier=" /mnt/hdd/raspiblitz.conf; then
echo "zerotier=off" >> /mnt/hdd/raspiblitz.conf
fi
# show info menu
if [ "$1" = "menu" ]; then
networkDetails=$(sudo zerotier-cli listnetworks | grep OK)
dialog --title " Info ZeroTier " --msgbox "\n\
Manage your ZeroTier account at https://my.zerotier.com. Add additional devices
(desktop/laptop/mobile) to your network so they can communicate.\n\n\
Currentlly connected to: $(echo $networkDetails | awk '{ print $3}')\n
Assigned IP: $(echo $networkDetails | awk '{ print $9}')\n\n\
Find more information on how to get started:\n
https://zerotier.atlassian.net/wiki/spaces/SD/pages/8454145/Getting+Started+with+ZeroTier
" 13 100
exit 0
fi
# install
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
if [ "${zerotier}" == "on" ]; then
echo "# FAIL - ZeroTier already installed"
sleep 3
exit 1
fi
echo "*** INSTALL ZeroTier ***"
# Download ZeroTier GPG key and install ZeroTier
curl -s 'https://raw.githubusercontent.com/zerotier/ZeroTierOne/master/doc/contact%40zerotier.com.gpg' | gpg --import
if z=$(curl -s 'https://install.zerotier.com/' | gpg); then echo "$z" | sudo bash; fi
# setting value in raspi blitz config
sudo sed -i "s/^zerotier=.*/zerotier=on/g" /mnt/hdd/raspiblitz.conf
echo ""
echo "# ZeroTier is now installed on your RaspiBlitz"
echo "# Check the ZeroTier menu entry for more details."
echo ""
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "*** REMOVING ZEROTIER ***"
sudo -u admin sudo apt -y purge zerotier-one
# setting value in raspi blitz config
sudo sed -i "s/^zerotier=.*/zerotier=off/g" /mnt/hdd/raspiblitz.conf
echo ""
echo "# OK, ZeroTier is removed."
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1