Merge pull request #11 from rootzoll/master

Tor fix
This commit is contained in:
bluecell296
2019-02-04 22:48:58 +00:00
committed by GitHub
32 changed files with 250 additions and 186 deletions

View File

@@ -192,7 +192,7 @@ else
if [ ${#dynDomain} -gt 0 ]; then
#check if dyndns resolves to correct IP
ipOfDynDNS=$(getent hosts rootzoll.chickenkiller.com | awk '{ print $1 }')
ipOfDynDNS=$(getent hosts ${dynDomain} | awk '{ print $1 }')
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
public_color="${color_red}"
else

View File

@@ -91,9 +91,8 @@ fi
if [ "${state}" = "ready" ]; then
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
echo "setup is done - loading config data"
echo "loading config data"
source ${configFile}
setupStep=100
else
echo "setup still in progress - setupStep(${setupStep})"
fi

View File

@@ -2,7 +2,9 @@
# get raspiblitz config
echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
echo "services default values"
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi

View File

@@ -1,6 +1,7 @@
#!/bin/bash
## get basic info
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# show password info dialog

View File

@@ -2,7 +2,7 @@
echo ""
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /home/admin/raspiblitz.info
echo "*** Adding HDD to the System ***"
echo "started from state(${state})"
@@ -14,7 +14,7 @@ if [ ${existsHDD} -gt 0 ]; then
if [ ${mountOK} -eq 1 ]; then
echo "FAIL - HDD is already mounted"
echo "If you want to add HDD freshly to the system, then unmount the HDD first and try again"
else
else
echo ""
echo "*** Check HDD ***"
formatExt4OK=$(lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | grep BLOCKCHAIN | grep -c ext4)
@@ -30,7 +30,7 @@ if [ ${existsHDD} -gt 0 ]; then
echo ${fstabAdd}
# adding the new line after line 3 to the /etc/fstab
sudo sed "3 a ${fstabAdd}" -i /etc/fstab
else
else
echo "UUID is already in /etc/fstab"
fi
fstabOK=$(cat /etc/fstab | grep -c ${uuid})
@@ -42,9 +42,26 @@ if [ ${existsHDD} -gt 0 ]; then
sudo mount -a
mountOK=$(df | grep -c /mnt/hdd)
if [ ${mountOK} -eq 1 ]; then
echo "OK - HDD is mounted"
echo ""
# init the RASPIBLITZ Config (if not exist on provision)
configExists=$(sudo ls /mnt/hdd/raspiblitz.conf | grep -c 'raspiblitz.conf')
if [ ${configExists} -eq 0 ]; then
echo "Creating raspiblitz.conf on HDD"
source /home/admin/_version.info
configFile="/mnt/hdd/raspiblitz.conf"
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
echo "hostname=${hostname}" >> $configFile
sudo chmod 777 ${configFile}
echo "OK"
echo ""
fi
# move SSH pub keys to HDD so that they survive an update
echo "moving SSH pub keys to HDD"
sudo cp -r /etc/ssh /mnt/hdd/ssh

View File

@@ -1,3 +1,6 @@
#!/bin/bash
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
### USER PI AUTOSTART (LCD Display)

View File

@@ -87,4 +87,4 @@ sudo apt-get update
echo "OK - System is now up to date"
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=90/g" /home/admin/raspiblitz.info
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info

View File

@@ -19,16 +19,6 @@ dialog --backtitle "RaspiBlitz - Setup" --title " RaspiBlitz Setup is done :) "
Press OK for a final reboot.
" 10 42
# init the RASPIBLITZ Config
echo "# RASPIBLITZ CONFIG FILE" > $configFile
echo "raspiBlitzVersion='${codeVersion}'" >> $configFile
sudo chmod 777 ${configFile}
# transfer data from SD info file
echo "hostname=${hostname}" >> $configFile
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
# let migration/init script do the rest
/home/admin/_bootstrap.migration.sh
@@ -39,7 +29,7 @@ cp $logFile /home/admin/raspiblitz.setup.log
echo "Setting the Name/Alias/Hostname .."
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
# mark setup is done (100%)
# mark setup is done
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
clear

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# get raspiblitz config
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# check if dynamic domain is set

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# load raspiblitz config data (with backup from old config)
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# make sure qrcode-encoder in installed

View File

@@ -1,6 +1,7 @@
#!/bin/bash
# load raspiblitz config data
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# export go vars (if needed)
@@ -25,7 +26,7 @@ if [ ${goInstalled} -eq 0 ];then
goInstalled=$(go version 2>/dev/null | grep -c 'go')
fi
if [ ${goInstalled} -eq 0 ];then
echo "FAIL: Was not able to install GO (needed to run ZapConnect)"
echo "FAIL: Was not able to install GO (needed to run LndConnect)"
exit 1
fi
@@ -35,11 +36,11 @@ echo "*** Setup ***"
echo ""
echo "Installing zapconnect. Please wait..."
echo ""
echo "Getting github.com/LN-Zap/zapconnect (please wait) ..."
go get -d github.com/LN-Zap/zapconnect
cd $GOPATH/src/github.com/LN-Zap/zapconnect
echo "Getting github.com/LN-Zap/lndconnect (please wait) ..."
go get -d github.com/LN-Zap/lndconnect
cd $GOPATH/src/github.com/LN-Zap/lndconnect
echo ""
echo "Building github.com/LN-Zap/zapconnect ..."
echo "Building github.com/LN-Zap/lndconnect ..."
make
cd
sleep 3
@@ -69,11 +70,11 @@ clear
echo "*** STEP 2 : Click on Scan (make whole QR code fill camera) ***"
if [ ${#dynDomain} -eq 0 ]; then
# If you drop the -i parameter, zapconnect will use the external IP.
zapconnect -i
# If you drop the -i parameter, lndconnect will use the external IP.
lndconnect -i
else
# when dynamic domain is set
zapconnect --host=${dynDomain}
lndconnect --host=${dynDomain}
fi
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
@@ -82,5 +83,5 @@ read key
clear
echo "If its not working - check issues on GitHub:"
echo "https://github.com/LN-Zap/zap-iOS/issues"
echo "https://github.com/LN-Zap/zapconnect/issues"
echo "https://github.com/LN-Zap/lndconnect/issues"
echo ""

View File

@@ -1,7 +1,8 @@
#!/bin/bash
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -5,7 +5,8 @@ _error="./.error.out"
echo "please wait ..."
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -1,7 +1,8 @@
#!/bin/bash
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -3,7 +3,8 @@ _temp="./download/dialog.$$"
_error="./.error.out"
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -4,7 +4,8 @@ _error="./.error.out"
sudo chmod 7777 ${_error}
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -1,7 +1,8 @@
#!/bin/bash
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -3,7 +3,8 @@ _temp="./download/dialog.$$"
_error="./.error.out"
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -3,7 +3,8 @@ _temp="./download/dialog.$$"
_error="./.error.out"
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then

View File

@@ -6,7 +6,8 @@
source /home/admin/_version.info
## get basic info (its OK if not set yet)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# for old nodes
if [ ${#network} -eq 0 ]; then

View File

@@ -16,6 +16,8 @@ configFile="/mnt/hdd/raspiblitz.conf"
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
source ${configFile}
else
source ${infoFile}
fi
echo "_background.sh STARTED"

View File

@@ -51,6 +51,9 @@ echo "message=" >> $infoFile
echo "network=${network}" >> $infoFile
echo "chain=${chain}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
if [ "${setupStep}" != "100" ]; then
echo "hostname=${hostname}" >> $infoFile
fi
sudo chmod 777 ${infoFile}
################################
@@ -324,7 +327,30 @@ fi
# SD INFOFILE BASICS
################################
# state info
sed -i "s/^state=.*/state=ready/g" ${infoFile}
sed -i "s/^message=.*/message='waiting login'/g" ${infoFile}
# determine network and chain from system
# check for BITCOIN
loaded=$(sudo systemctl status bitcoind | grep -c 'loaded')
if [ ${loaded} -gt 0 ]; then
sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
source /mnt/hdd/bitcoin/bitcoin.conf
if [ ${testnet} -gt 0 ]; then
sed -i "s/^chain=.*/chain=test/g" ${infoFile}
else
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
fi
fi
# check for LITECOIN
loaded=$(sudo systemctl status litecoind | grep -c 'loaded')
if [ ${loaded} -gt 0 ]; then
sed -i "s/^network=.*/network=litecoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
fi
echo "DONE BOOTSTRAP" >> $logFile
exit 0

View File

@@ -18,7 +18,8 @@ fi
_temp="./dialog.$$"
# load raspiblitz config (if available)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
network="bitcoin"
fi

View File

@@ -9,6 +9,7 @@ fi
# check and load raspiblitz config
# to know which network is running
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
@@ -45,7 +46,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** Get the RTL Source Code ***"
git clone https://github.com/ShahanaFarooqui/RTL.git
cd RTL
git reset --hard v0.1.12-alpha
git reset --hard v0.1.13-alpha
# install
echo "*** Run: npm install ***"

View File

@@ -14,6 +14,7 @@ fi
# check and load raspiblitz config
# to know which network is running
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
@@ -55,24 +56,61 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo ""
fi
echo "*** Updating System ***"
sudo apt-get update
echo ""
# check if TOR package is installed
packageInstalled=$(dpkg -s tor-arm | grep -c 'Status: install ok')
if [ ${packageInstalled} -eq 0 ]; then
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
# Prepare for TOR service
echo "*** Install TOR repo keys ***"
echo ""
echo "*** Tor Config ***"
sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor
sudo mkdir /mnt/hdd/tor/sys
sudo mkdir /mnt/hdd/tor/web80
sudo mkdir /mnt/hdd/tor/lnd9735
sudo mkdir /mnt/hdd/tor/lndrpc9735
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
recvKeyResult=$(sudo gpg --keyserver keys.gnupg.net --recv 886DDD89 2>&1)
echo "${recvKeyResult}"
recvKeyFailed=$(echo "${recvKeyResult}" | grep -c 'Total number processed: 0')
if [ ${recvKeyFailed} -eq 1 ]; then
echo "FAILED: sudo gpg --keyserver keys.gnupg.net --recv 886DDD89"
exit 1
fi
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
echo ""
recvKeyResult=$(sudo gpg --keyserver pgpkeys.mit.edu --recv-key 74A941BA219EC810 2>&1)
echo "${recvKeyResult}"
recvKeyFailed=$(echo "${recvKeyResult}" | grep -c 'Total number processed: 0')
if [ ${recvKeyFailed} -eq 1 ]; then
echo "FAILED: sudo gpg --keyserver pgpkeys.mit.edu --recv-key 74A941BA219EC810"
exit 1
fi
sudo gpg -a --export 74A941BA219EC810 | sudo apt-key add -
echo ""
echo "*** Adding Tor Sources to sources.list ***"
echo "deb https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "deb-src https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list
echo "OK"
echo ""
echo "*** Updating System ***"
sudo apt-get update
echo ""
echo "*** Installing dirmngr ***"
sudo apt install dirmngr -y
echo ""
echo "*** Install Tor ***"
sudo apt install tor tor-arm -y
echo ""
echo "*** Tor Config ***"
#sudo rm -r -f /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor 2>/dev/null
sudo mkdir /mnt/hdd/tor/sys 2>/dev/null
sudo mkdir /mnt/hdd/tor/web80 2>/dev/null
sudo mkdir /mnt/hdd/tor/lnd9735 2>/dev/null
sudo mkdir /mnt/hdd/tor/lndrpc9735 2>/dev/null
sudo chmod -R 700 /mnt/hdd/tor
sudo chown -R bitcoin:bitcoin /mnt/hdd/tor
cat > ./torrc <<EOF
### See 'man tor', or https://www.torproject.org/docs/tor-manual.html
DataDirectory /mnt/hdd/tor/sys
@@ -110,94 +148,62 @@ HiddenServicePort 9735 127.0.0.1:9735
# NOTE: bitcoind get tor service automatically - see /mnt/hdd/bitcoin for onion key
EOF
sudo rm $torrc
sudo mv ./torrc $torrc
sudo chmod 644 $torrc
sudo chown -R bitcoin:bitcoin /var/run/tor/
echo ""
sudo rm $torrc
sudo mv ./torrc $torrc
sudo chmod 644 $torrc
sudo chown -R bitcoin:bitcoin /var/run/tor/
echo ""
# NYX - Tor monitor tool
# https://nyx.torproject.org/#home
echo "*** Installing NYX - TOR monitoring Tool ***"
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
if [ ${nyxInstalled} -eq 0 ]; then
sudo pip install nyx
else
echo "NYX already installed"
fi
echo ""
# NYX - Tor monitor tool
# https://nyx.torproject.org/#home
echo "*** Installing NYX - TOR monitoring Tool ***"
nyxInstalled=$(sudo pip list 2>/dev/null | grep 'nyx' -c)
if [ ${nyxInstalled} -eq 0 ]; then
sudo pip install nyx
else
echo "NYX already installed"
fi
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl enable tor@default
echo ""
echo "*** Activating TOR system service ***"
echo "ReadWriteDirectories=-/mnt/hdd/tor" | sudo tee -a /lib/systemd/system/tor@default.service
sudo systemctl daemon-reload
sudo systemctl enable tor@default
echo ""
#echo "*** Waiting for TOR to boostrap ***"
#torIsBootstrapped=0
#while [ ${torIsBootstrapped} -eq 0 ]
#do
# echo "--- Checking 1 ---"
# date +%s
# sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped" | tail -n 10
# torIsBootstrapped=$(sudo cat /mnt/hdd/tor/notice.log 2>/dev/null | grep "Bootstrapped 100" -c)
# echo "torIsBootstrapped(${torIsBootstrapped})"
# echo "If this takes too long --> CTRL+c, reboot and check manually"
# sleep 5
#done
#echo "OK - Tor Bootstrap is ready"
#echo ""
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; then
echo "*** Changing ${network} Config ***"
networkIsTor=$(sudo cat /home/bitcoin/.${network}/${network}.conf | grep 'onlynet=onion' -c)
if [ ${networkIsTor} -eq 0 ]; then
echo "Only Connect thru TOR"
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "Only Connect thru TOR"
echo "onlynet=onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
if [ "${network}" = "bitcoin" ]; then
echo "Adding some bitcoin onion nodes to connect to"
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
fi
if [ "${network}" = "bitcoin" ]; then
echo "Adding some bitcoin onion nodes to connect to"
echo "addnode=fno4aakpl6sg6y47.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=toguvy5upyuctudx.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=ndndword5lpb7eex.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=6m2iqgnqjxh7ulyk.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
echo "addnode=5tuxetn7tar3q5kp.onion" | sudo tee --append /home/bitcoin/.${network}/${network}.conf
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
else
echo "Chain network already configured for TOR"
fi
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
else
echo "Chain network already configured for TOR"
echo "TOR package/service is installed and was prepared earlier .. just activating again"
echo "*** Enable TOR service ***"
sudo systemctl ensable tor@default
echo ""
fi
#echo "*** ${network} re-init - Waiting for Onion Address ***"
# restarting bitcoind to start with tor and generare onion.address
#echo "restarting ${network}d ..."
#sudo systemctl restart ${network}d
#sleep 8
#onionAddress=""
#while [ ${#onionAddress} -eq 0 ]
#do
# echo "--- Checking 2 ---"
# date +%s
# testNetAdd=""
# if [ "${chain}" = "test" ];then
# testNetAdd="/testnet3"
# fi
# sudo cat /mnt/hdd/${network}${testNetAdd}/debug.log 2>/dev/null | grep "tor" | tail -n 10
# onionAddress=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"address"' | cut -d '"' -f4)
# echo "Can take up to 20min - if this takes longer --> CTRL+c, reboot and check manually"
# sleep 5
#done
#onionPort=$(sudo -u bitcoin ${network}-cli getnetworkinfo | grep '"port"' | tr -dc '0-9')
#echo "Your Chain Network Onion Address is: ${onionAddress}:${onionPort}"
#echo ""
#echo "*** Setting your Onion Address ***"
#onionLND=$(sudo cat /mnt/hdd/tor/lnd9735/hostname)
#echo "Your Lightning Tor Onion Address is: ${onionLND}:9735"
#echo ""
# ACTIVATE LND OVER TOR
echo "*** Putting LND behind TOR ***"

View File

@@ -27,6 +27,7 @@ echo "making sure services are not running"
sudo systemctl stop lnd 2>/dev/null
# add default value to raspi config if needed
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#autoNatDiscovery} -eq 0 ]; then
echo "autoNatDiscovery=off" >> /mnt/hdd/raspiblitz.conf

View File

@@ -28,6 +28,7 @@ if [ ${valueExists} -eq 0 ]; then
fi
# add default value to raspi config if needed
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#autoPilot} -eq 0 ]; then
echo "autoPilot=off" >> /mnt/hdd/raspiblitz.conf

View File

@@ -42,7 +42,8 @@ if [ "$1" = "" ] || [ $# -eq 0 ]; then
fi
# load data from config
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
########################
# CANCEL

View File

@@ -15,9 +15,10 @@ fi
# check and load raspiblitz config
# to know which network is running
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
echo "FAIL - missing network info"
exit 1
fi

View File

@@ -9,7 +9,8 @@ fi
# check and load raspiblitz config
# to know which network is running
source /mnt/hdd/raspiblitz.conf 2>/dev/null
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
exit 1
@@ -41,6 +42,7 @@ fi
# while loop to wait to finish
finished=0
progress=0
while [ ${finished} -eq 0 ]
do
clear
@@ -51,13 +53,19 @@ while [ ${finished} -eq 0 ]
echo "THIS CAN TAKE SOME LONG TIME"
echo "If you dont see any progress after 24h keep X pressed to stop."
progress=0
echo ""
echo "PROGRESS: ${progress}%"
echo ""
# get blockchain sync progress
blockchaininfo=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo)
progress=$(echo "${blockchaininfo}" | jq -r '.verificationprogress')
#progress=$(echo "${progress}*100" | bc)
inprogress="$(echo "${blockchaininfo}" | jq -r '.initialblockdownload')"
if [ "${inprogress}" = "false" ]; then
finished=1
fi
#TODO: detect and display progress
#TODO: determine when finished and then finished=1
echo ""
echo "RUNNING: ${inprogress}"
echo "PROGRESS: ${progress}"
echo ""
echo "You can close terminal while reindex is running.."
echo "But you have to login again to check if ready."
@@ -73,9 +81,14 @@ while [ ${finished} -eq 0 ]
done
# trigger reboot when finished
echo "*************************"
echo "Re-Index finished"
if [ ${finished} -eq 0 ]; then
echo "Re-Index CANCELED"
else
echo "Re-Index finished"
fi
echo "Starting reboot ..."
echo "*************************"
# stop bitcoind