Browse Source

Merge pull request #439 from rootzoll/v1.1

V1.1 testing merges
sshtunnel
Christian Rotzoll 6 years ago
committed by GitHub
parent
commit
d4277a94e7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      README.md
  2. 55
      build_sdcard.sh
  3. 10
      home.admin/00infoBlitz.sh
  4. 30
      home.admin/00infoLCD.sh
  5. 22
      home.admin/00mainMenu.sh
  6. 3
      home.admin/50copyHDD.sh
  7. 8
      home.admin/50torrentHDD.sh
  8. 4
      home.admin/97addMobileWalletZap.sh
  9. 14
      home.admin/_bootstrap.provision.sh

4
README.md

@ -38,8 +38,8 @@ The RaspiBlitz is build from the following parts:
* RaspBerryPi 3 B+
* 1TB Hard Drive
* LCD-Display
* Micro SD-Card 16GB
* Powersupply >=3A (big & stable)
* Micro SD-Card (min 16GB - go for quality)
* Powersupply >=3A (choose big & stable output)
* Cheap Casing
**All together under 150 USD / 130 EUR (depending on country & shop)**

55
build_sdcard.sh

@ -157,7 +157,24 @@ sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 li
# change log rotates
# see https://github.com/rootzoll/raspiblitz/issues/394#issuecomment-471535483
sudo head -n 18 /etc/logrotate.d/rsyslog > ./rsyslog
echo "/var/log/syslog" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 7" >> ./rsyslog
echo " daily" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
echo "/var/log/mail.info" >> ./rsyslog
echo "/var/log/mail.warn" >> ./rsyslog
echo "/var/log/mail.err" >> ./rsyslog
echo "/var/log/mail.log" >> ./rsyslog
echo "/var/log/daemon.log" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " size=100M" >> ./rsyslog
@ -171,7 +188,38 @@ echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
sudo tail -n +19 /etc/logrotate.d/rsyslog >> ./rsyslog
echo "/var/log/kern.log" >> ./rsyslog
echo "/var/log/auth.log" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " size=100M" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " sharedscripts" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
echo "" >> ./rsyslog
echo "/var/log/user.log" >> ./rsyslog
echo "/var/log/lpr.log" >> ./rsyslog
echo "/var/log/cron.log" >> ./rsyslog
echo "/var/log/debug" >> ./rsyslog
echo "/var/log/messages" >> ./rsyslog
echo "{" >> ./rsyslog
echo " rotate 4" >> ./rsyslog
echo " weekly" >> ./rsyslog
echo " missingok" >> ./rsyslog
echo " notifempty" >> ./rsyslog
echo " compress" >> ./rsyslog
echo " delaycompress" >> ./rsyslog
echo " sharedscripts" >> ./rsyslog
echo " postrotate" >> ./rsyslog
echo " invoke-rc.d rsyslog rotate > /dev/null" >> ./rsyslog
echo " endscript" >> ./rsyslog
echo "}" >> ./rsyslog
sudo mv ./rsyslog /etc/logrotate.d/rsyslog
sudo chown root:root /etc/logrotate.d/rsyslog
sudo service rsyslog restart
@ -186,6 +234,9 @@ sudo apt-get install -y htop git curl bash-completion jq dphys-swapfile
# installs bandwidth monitoring for future statistics
sudo apt-get install -y vnstat
# prepare for BTRFS data drive raid
sudo apt-get install -y btrfs-tools
# prepare for display graphics mode
# see https://github.com/rootzoll/raspiblitz/pull/334
sudo apt-get install -y fbi

10
home.admin/00infoBlitz.sh

@ -215,6 +215,10 @@ ln_channelInfo="\n"
ln_external="\n"
ln_alias="${hostname}"
ln_publicColor=""
ln_port=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
if [ ${#ln_port} -eq 0 ]; then
ln_port="9735"
fi
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
if [ "$wallet_unlocked" -gt 0 ] ; then
@ -227,7 +231,7 @@ else
if [ ${ln_tor} -eq 1 ]; then
ln_publicColor="${color_green}"
else
public_check=$(nc -z -w6 ${public_ip} 9735 2>/dev/null; echo $?)
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
if [ $public_check = "0" ]; then
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
ln_publicColor="${color_yellow}"
@ -282,7 +286,7 @@ ${color_yellow} /,' ${color_gray}
${color_yellow} /' ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
${color_yellow}
${color_yellow}${ln_publicColor}${ln_external}
${color_yellow}${ln_publicColor}${ln_external}${color_red}
" \
"RaspiBlitz v${codeVersion}" \
@ -291,5 +295,5 @@ ${color_yellow}${ln_publicColor}${ln_external}
"${hdd}" "${sync_percentage}"
if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then
echo "${undervoltageReports} undervoltage reports found in syslog"
echo "${undervoltageReports} undervoltage reports found - maybe upgrade power supply"
fi

30
home.admin/00infoLCD.sh

@ -160,6 +160,36 @@ while :
# DISPLAY AFTER SETUP
###########################
if [ "${state}" = "repair" ]; then
l1="Repair Mode\n"
l2="ssh admin@${localip}\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
if [ "${state}" = "retorrent" ]; then
l1="Repair Mode- TORRENT\n"
l2="ssh admin@${localip}\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
if [ "${state}" = "recopy" ]; then
l1="Repair Mode - COPY\n"
l2="ssh admin@${localip}\n"
l3="Use password: PasswordA\n"
boxwidth=$((${#localip} + 28))
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
sleep 3
continue
fi
# check if bitcoin is ready
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
clienterror=`cat error.tmp`

22
home.admin/00mainMenu.sh

@ -65,6 +65,15 @@ if [ "${state}" = "reindex" ]; then
exit 1
fi
# singal that torrent is in re-download
if [ "${state}" = "retorrent" ]; then
echo "Re-Index in progress ... start monitoring:"
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit
fi
# if pre-sync is running - stop it - before continue
if [ "${state}" = "presync" ]; then
# stopping the pre-sync
@ -141,11 +150,15 @@ waitUntilChainNetworkIsReady()
rm error.tmp
# check for missing blockchain data
blockchainsize=$(sudo du /mnt/hdd/bitcoin | head -n1 | awk '{print $1;}')
minSize=250000000000
if [ "${network}" = "litecoin" ]; then
minSize=20000000000
fi
blockchainsize=$(sudo du -shbc /mnt/hdd/${network} | head -n1 | awk '{print $1;}')
echo "blockchainsize(${blockchainsize})"
if [ ${#blockchainsize} -gt 0 ]; then
if [ ${blockchainsize} -lt 1000000 ]; then
echo "Mission Blockchain Data ..."
if [ ${blockchainsize} -lt ${minSize} ]; then
echo "Missing Blockchain Data (<${minSize}) ..."
clienterror="missing blockchain"
sleep 3
fi
@ -157,6 +170,7 @@ waitUntilChainNetworkIsReady()
reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
sleep 3
dialog --backtitle "RaspiBlitz - Repair Script" --msgbox "Your blockchain data needs to be repaired.
@ -184,6 +198,7 @@ To run a BACKUP of funds & channels first is recommended.
echo "Starting TORRENT ..."
sudo sed -i "s/^state=.*/state=retorrent/g" /home/admin/raspiblitz.info
/home/admin/50torrentHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit
@ -191,6 +206,7 @@ To run a BACKUP of funds & channels first is recommended.
echo "Starting COPY ..."
sudo sed -i "s/^state=.*/state=recopy/g" /home/admin/raspiblitz.info
/home/admin/50copyHDD.sh
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
/home/admin/00mainMenu.sh
exit

3
home.admin/50copyHDD.sh

@ -35,7 +35,6 @@ if [ "${setupStep}" = "100" ]; then
echo "stopping servcies ..."
sudo systemctl stop lnd
sudo systemctl stop bitcoind
sudo systemctl disable bitcoind
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
fi
@ -72,7 +71,7 @@ echo "COPY, PASTE & EXECUTE the following command on the blockchain source compu
if [ "${CHOICE}" = "WINDOWS" ]; then
echo "sudo scp -r ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
else
echo "sudo rsync -avhW --info=progress2 ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
echo "sudo rsync -avhW --progress ./chainstate ./indexes ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
fi
echo ""
echo "This command may ask you first about the admin password of the other computer (because sudo)."

8
home.admin/50torrentHDD.sh

@ -7,6 +7,14 @@ echo ""
## get basic info
source /home/admin/raspiblitz.info
# if setup was done - remove old data
if [ "${setupStep}" = "100" ]; then
echo "stopping servcies ..."
sudo systemctl stop lnd
sudo systemctl stop ${network}d
fi
# make sure rtorrent is available
sudo apt-get install rtorrent -y
echo ""

4
home.admin/97addMobileWalletZap.sh

@ -44,9 +44,9 @@ fi
# make sure qrcode-encoder in installed
echo "*** Setup ***"
echo ""
echo "Installing zapconnect. Please wait..."
echo "Installing zapconnect."
echo ""
echo "Getting github.com/LN-Zap/lndconnect (please wait) ..."
echo "Getting github.com/LN-Zap/lndconnect (please wait - can take several minutes) ..."
go get -d github.com/LN-Zap/lndconnect
cd $GOPATH/src/github.com/LN-Zap/lndconnect
echo ""

14
home.admin/_bootstrap.provision.sh

@ -156,6 +156,20 @@ else
echo "Provisioning TOR - keep default" >> ${logFile}
fi
# CUSTOM PORT
echo "Provisioning LND Port" >> ${logFile}
lndPort=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
if [ ${#lndPort} -gt 0 ]; then
if [ "${lndPort}" != "9735" ]; then
echo "User is running custom LND port: ${lndPort}" >> ${logFile}
sudo /home/admin/config.scripts/lnd.setport.sh ${lndPort} >> ${logFile} 2>&1
else
echo "User is running standard LND port: ${lndPort}" >> ${logFile}
fi
else
echo "Was not able to get LND port from config." >> ${logFile}
fi
sudo sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile}
echo "DONE - Give raspi some cool off time after hard building .... 20 secs sleep" >> ${logFile}

Loading…
Cancel
Save