From ff32129e2839f61768069be2340aa6b2695c531e Mon Sep 17 00:00:00 2001 From: openoms Date: Tue, 29 Jan 2019 12:24:37 +0000 Subject: [PATCH] updated copy script, added net-tools, added to readme --- DietPi/install.md | 4 +- README.md | 7 +++- build.sdcard/raspbianStretchDesktop.sh | 19 +++++---- home.admin/50copyHDD.sh | 54 +++++++++++++++++++------- home.admin/70initLND.sh | 4 +- 5 files changed, 63 insertions(+), 25 deletions(-) diff --git a/DietPi/install.md b/DietPi/install.md index 856b4d467..3962ed26e 100644 --- a/DietPi/install.md +++ b/DietPi/install.md @@ -28,7 +28,7 @@ Reboots again `ssh root@[IP-OF-DIETPI]` Now only the bash prompt opens -sudo apt install rsync +sudo apt install -y rsync (now added to the script) use: wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build.sdcard/raspbianStretchDesktop.sh && sudo bash raspbianStretchDesktop.sh [BRANCH] [GITHUB-USERNAME] @@ -38,7 +38,7 @@ password: raspiblitz see my output: [sdcard_build_output](sdcard_build_output.html) The only fault appears to be with `fail2ban` - +(this is solved if fail2ban is intalled from the DietPi software settings during the second boot) `ssh admin@[IP-OF-DROIDBLITZ]` password: raspiblitz diff --git a/README.md b/README.md index 955cefd8d..97232946d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,15 @@ [ [Hardware](#hardware-needed-amazon-shopping-list) ] -- [ [Setup](#boot-your-raspiblitz) ] -- [ [Documentation](#documentation) ] -- [ [Development](#further-development-of-raspiblitz) ] ----- +# DroidBlitz with DietPi + +see: [/DietPi/install.md](/DietPi/install.md) + + # RaspiBlitz Fastest and cheapest way to get your own Lightning Node running - on a RaspberryPi with a nice LCD. -`Version 0.98 (1.0 RC1) with lnd 0.5.1 and bitcoin 0.17.0.1 & litecoin 0.16.3.` +`Version 0.99 (1.0 RC1) with lnd 0.5.1 and bitcoin 0.17.0.1 & litecoin 0.16.3.` ![RaspiBlitz](pictures/raspiblitz.jpg) diff --git a/build.sdcard/raspbianStretchDesktop.sh b/build.sdcard/raspbianStretchDesktop.sh index a9af5aa08..1bd61960c 100644 --- a/build.sdcard/raspbianStretchDesktop.sh +++ b/build.sdcard/raspbianStretchDesktop.sh @@ -1,16 +1,14 @@ #!/bin/bash ######################################################################### # Build your SD card image based on: -# RASPBIAN STRETCH WITH DESKTOP (2018-11-13) -# https://www.raspberrypi.org/downloads/raspbian/ -# SHA256: a121652937ccde1c2583fe77d1caec407f2cd248327df2901e4716649ac9bc97 +# DietPi.com ########################################################################## # setup fresh SD card with image above - login per SSH and run this script: ########################################################################## echo "" echo "*****************************************" -echo "* RASPIBLITZ SD CARD IMAGE SETUP v0.99 *" +echo "* DROIDLITZ SD CARD IMAGE SETUP v0.1 *" echo "*****************************************" echo "" @@ -94,12 +92,17 @@ if [ "${baseImage}" = "dietpi" ]; then echo "*** PREPARE DietPi ***" echo "renaming dietpi user to pi" sudo usermod -l pi dietpi + # add pi to the sudo group sudo adduser pi sudo echo "install pip" sudo apt-get update sudo apt-get remove -y fail2ban sudo apt-get install -y build-essential sudo apt-get install -y python-pip + # rsync is needed to copy from HDD + sudo apt install -y rsync + # install ifconfig + sudo apt install -y net-tools fi # special prepare when Raspbian @@ -442,14 +445,16 @@ sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin sudo -u admin chmod +x /home/admin/config.scripts/*.sh -# prifile path for admin +# profile path for admin sudo bash -c "echo '' >> /home/admin/.profile" sudo bash -c "echo 'GOROOT=/usr/local/go' >> /home/admin/.profile" sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin' >> /home/admin/.profile" sudo bash -c "echo 'GOPATH=/usr/local/gocode' >> /home/admin/.profile" sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/bin' >> /home/admin/.profile" +# add /sbin to path for admin +sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/sbin' >> /home/admin/.profile" -# bash aoutstart for admin +# bash autostart for admin sudo bash -c "echo '# shortcut commands' >> /home/admin/.bashrc" sudo bash -c "echo 'source /home/admin/_commands.sh' >> /home/admin/.bashrc" sudo bash -c "echo '# automatically start main menu for admin' >> /home/admin/.bashrc" @@ -537,7 +542,7 @@ echo "Press ENTER to install LCD and reboot ..." read key # give Raspi a default hostname (optional) -sudo raspi-config nonint do_hostname "RaspiBlitz" +sudo raspi-config nonint do_hostname "DroidBlitz" # *** Display selection *** dialog --title "Display" --yesno "Are you using the default display available from Amazon?\nSelect 'No' if you are using the Swiss version from play-zone.ch!" 6 80 diff --git a/home.admin/50copyHDD.sh b/home.admin/50copyHDD.sh index 69c9a8c43..e5bb49b26 100755 --- a/home.admin/50copyHDD.sh +++ b/home.admin/50copyHDD.sh @@ -12,7 +12,26 @@ if [ ${hddA} -eq 0 ]; then echo "Try 'sudo shutdown -r now'" exit 1 fi -echo "OK - HDD as sda1 found" + +ready=0 +while [ ${ready} -eq 0 ] + do + hddA=$(lsblk | grep /mnt/hdd | grep -c sda1) + if [ ${hddB} -eq 1 ]; then + echo "OK - HDD as sda1 found" + ready=1 + if [ ${hddA} -eq 0 ]; then + echo "FAIL - 1st HDD not found as sda1 or sda" + echo "Try 'sudo shutdown -r now'" + exit 1 + fi + hddB=$(lsblk | grep -c sda) + if [ ${hddB} -eq 1 ]; then + echo "OK - HDD as sda found" + ready=1 + fi + done + echo "" echo "*** Copy Blockchain form a second HDD ***" echo "" @@ -34,17 +53,14 @@ echo "then cancel (CTRL+c) and reboot." ready=0 while [ ${ready} -eq 0 ] do - hddA=$(lsblk | grep /mnt/hdd | grep -c sda1) - if [ ${hddA} -eq 0 ]; then - echo "FAIL - connection to 1st HDD lost" - echo "It seems there was a POWEROUTAGE while connecting the 2nd HDD." - echo "Try to avoid this next time by adding extra Power or connect more securely." - echo "You need now to reboot with 'sudo shutdown -r now' and then try again." - exit 1 - fi - hddB=$(lsblk | grep -c sdb1) + hddC=$(lsblk | grep -c sdb1) if [ ${hddB} -eq 1 ]; then - echo "OK - 2nd HDD found" + echo "OK - 2nd HDD found as sdb1" + ready=1 + fi + hddD=$(lsblk | grep -c sdb) + if [ ${hddB} -eq 1 ]; then + echo "OK - 2nd HDD found as sdb" ready=1 fi done @@ -52,16 +68,28 @@ while [ ${ready} -eq 0 ] echo "" echo "*** Mounting 2nd HDD ***" sudo mkdir /mnt/genesis -echo "try ext4 .." +echo "try ext4 on sdb1 .." sudo mount -t ext4 /dev/sdb1 /mnt/genesis sleep 2 mountOK=$(lsblk | grep -c /mnt/genesis) if [ ${mountOK} -eq 0 ]; then - echo "try exfat .." + echo "try exfat on sdb1 .." sudo mount -t exfat /dev/sdb1 /mnt/genesis sleep 2 fi mountOK=$(lsblk | grep -c /mnt/genesis) +if [ ${mountOK} -eq 0 ]; then + echo "try ext4 on sdb .." + sudo mount -t ext4 /dev/sdb /mnt/genesis + sleep 2 +fi +mountOK=$(lsblk | grep -c /mnt/genesis) +if [ ${mountOK} -eq 0 ]; then + echo "try exfat on sdb.." + sudo mount -t exfat /dev/sdb /mnt/genesis + sleep 2 +fi +mountOK=$(lsblk | grep -c /mnt/genesis) if [ ${mountOK} -eq 0 ]; then echo "FAIL - not able to mount the 2nd HDD" echo "only ext4 and exfat possible" diff --git a/home.admin/70initLND.sh b/home.admin/70initLND.sh index d7547dfcb..4a95199fb 100755 --- a/home.admin/70initLND.sh +++ b/home.admin/70initLND.sh @@ -75,7 +75,7 @@ echo "" ###### Start LND echo "*** Starting LND ***" -lndRunning=$(systemctl status lnd.service 2>/dev/null | grep -c running) +lndRunning=$(sudo systemctl status lnd.service 2>/dev/null | grep -c running) if [ ${lndRunning} -eq 0 ]; then sed -i "5s/.*/Wants=${network}d.service/" ./assets/lnd.service sed -i "6s/.*/After=${network}d.service/" ./assets/lnd.service @@ -91,7 +91,7 @@ fi lndRunning=0 while [ ${lndRunning} -eq 0 ] do - lndRunning=$(systemctl status lnd.service | grep -c running) + lndRunning=$(sudo systemctl status lnd.service | grep -c running) if [ ${lndRunning} -eq 0 ]; then date +%s echo "LND not ready yet ... waiting another 60 seconds."