diff --git a/alternative.platforms/README.md b/alternative.platforms/README.md index f0a5b1ee7..00fd02210 100644 --- a/alternative.platforms/README.md +++ b/alternative.platforms/README.md @@ -1,7 +1,7 @@ # ⚡️ Alternative platforms for the RaspiBlitz ⚡️ Minimum requirements: -* ARM V7 or V8 processor architecture (32 or 64 bit) +* ARMv7, ARMv8 or x86 processor (32 or 64 bit) * 1 GB RAM * \> 300 GB HDD @@ -30,7 +30,7 @@ Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/). Assemble and boot. -`ssh root@192.168.1.122` +`ssh root@192.168.x.x` password: 1234 @@ -51,7 +51,7 @@ Burn the image to the SDCard with [Etcher](https://www.balena.io/etcher/). Assemble and boot. -`ssh root@192.168.1.122` +`ssh root@192.168.x.x` password: odroid @@ -86,7 +86,7 @@ Tested on: The HDMI screen tested: https://www.aliexpress.com/item/3-5-inch-LCD-HDMI-USB-Touch-Screen-Real-HD-1920x1080-LCD-Display-Py-for-Raspberri/32818537950.html -Detailed instructions for the RaspiBlitz-on-DietPi: [/dietpi/README.md](/dietpi/README.md) +Detailed instructions for the RaspiBlitz-on-DietPi: [alternative.platforms/dietpi/README.md](/alternative.platforms/dietpi/README.md) --- Extras for advanced users and powerful hardware: diff --git a/dietpi/Odroid_HC1_XU4.md b/alternative.platforms/dietpi/Odroid_HC1_XU4.md similarity index 85% rename from dietpi/Odroid_HC1_XU4.md rename to alternative.platforms/dietpi/Odroid_HC1_XU4.md index 3f5890b26..a58ef3fc1 100644 --- a/dietpi/Odroid_HC1_XU4.md +++ b/alternative.platforms/dietpi/Odroid_HC1_XU4.md @@ -34,13 +34,13 @@ The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootz https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z 2) Burn it to the SD card with [Etcher](https://www.balena.io/etcher/) -3) Right click and download the following two files: [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/Automation_Custom_Script.sh) +3) Right click and download the following two files: [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh) 4) Copy them to the /boot directory of the DietPi SDcard - [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/dev/dietpi#excerpts-from-the-customized-dietpitxt)) + [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/master/alternative.platforms/dietpi#excerpts-from-the-customized-dietpitxt)) - [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll. + [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll. (Optionally open the file with a text editor and uncomment (remove the `#` from the front of) the line with the branch you want to build the SDcard from.) 5) Assemble and boot the Odroid @@ -133,14 +133,14 @@ Changing the SSH server will change the SSH keys again. To clear: ### Run the RaspiBlitz build_sdcard.sh script -* Format of the command to build the SDcard: +* Run this command to build from the master branch of @rootzoll: +`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build_sdcard.sh && sudo bash build_sdcard.sh` +This will take a couple minutes depending on your internet ceonnection and the processing power of the SBC. + +* Format of the command to build the SDcard from an alternative branch: `wget https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh [BRANCH] [GITHUB-USERNAME]` If you are working from a forked repo be aware of that the fork needs to be called `raspiblitz` for the git downloads to work. -* Example: run from the dev branch @rootzoll: -`wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/build_sdcard.sh && sudo bash build_sdcard.sh dev rootzoll` -This will take a couple minutes depending on your internet ceonnection and the processing power of the SBC. - * Restart when done and log back in now as `admin`: `ssh admin@[IP-OF-DROIDBLITZ]` password: `raspiblitz` diff --git a/dietpi/README.md b/alternative.platforms/dietpi/README.md similarity index 96% rename from dietpi/README.md rename to alternative.platforms/dietpi/README.md index 8d41e2a80..1b41ae88e 100644 --- a/dietpi/README.md +++ b/alternative.platforms/dietpi/README.md @@ -18,7 +18,7 @@ The HDMI screen tested: https://www.aliexpress.com/item/3-5-inch-LCD-HDMI-USB-To [Raspberry Pi](RaspberryPi.md) -[Display install script](dietpi.display.sh) +[Display install script](/alternative.platforms/display.alternatives.sh) --- @@ -91,7 +91,7 @@ During the RaspiBlitz setup process: --- -## Excerpts from the [customized dietpi.txt](/dietpi/boot/dietpi.txt) +## Excerpts from the [customized dietpi.txt]/alternative.platforms/dietpi/boot/dietpi.txt) to be used for a fully automatic SDcard building process. ### Automate installation with the dietpi.txt @@ -129,7 +129,7 @@ Option 1 = Copy your script to /boot/Automation_Custom_Script.sh and it will be Option 2 = Host your script online, then use AUTO_SETUP_CUSTOM_SCRIPT_EXEC=http://myweb.com/myscript.sh, it will be downloaded and executed automatically. | 0=disabled NB: Executed script log /var/tmp/dietpi/logs/dietpi-automation_custom_script.log -Find the Automation_Custom_Script.sh loaded with the build_sdcard.sh [here](/dietpi/boot/Automation_Custom_Script.sh) +Find the Automation_Custom_Script.sh loaded with the build_sdcard.sh [here]/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh) --- ## Guide to clone your SD-cards in Windows, MacOS and Linux and shrink the image in Linux: diff --git a/dietpi/RaspberryPi.md b/alternative.platforms/dietpi/RaspberryPi.md similarity index 65% rename from dietpi/RaspberryPi.md rename to alternative.platforms/dietpi/RaspberryPi.md index aa52f83ee..4aa681cd5 100644 --- a/dietpi/RaspberryPi.md +++ b/alternative.platforms/dietpi/RaspberryPi.md @@ -8,13 +8,13 @@ https://dietpi.com/downloads/images/DietPi_RPi-ARMv6-Stretch.7z 2) Burn it to the SD card with [Etcher](https://www.balena.io/etcher/) -3) Right click and download the following two files: [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/Automation_Custom_Script.sh) +3) Right click and download the following two files: [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh) 4) Copy them to the /boot directory of the DietPi SDcard - [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/dev/dietpi#excerpts-from-the-customized-dietpitxt)) + [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/master/alternative.platforms/dietpi#excerpts-from-the-customized-dietpitxt)) - [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll. + [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll. (Optionally open the file with a text editor and uncomment (remove the `#` from the front of) the line with the branch you want to build the SDcard from.) 5) Assemble and boot the Raspberry Pi @@ -37,4 +37,4 @@ password: `raspiblitz` --- ### To build manually: -[Follow the generic DietPi install process.](https://github.com/rootzoll/raspiblitz/tree/dev/dietpi#general-guide-for-the-raspiblitz-on-dietpi) +[Follow the generic DietPi install process.](https://github.com/rootzoll/raspiblitz/tree/master/alternative.platforms/dietpi#general-guide-for-the-raspiblitz-on-dietpi) diff --git a/dietpi/boot/Automation_Custom_Script.sh b/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh similarity index 73% rename from dietpi/boot/Automation_Custom_Script.sh rename to alternative.platforms/dietpi/boot/Automation_Custom_Script.sh index 5a207abab..61912e8b3 100644 --- a/dietpi/boot/Automation_Custom_Script.sh +++ b/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh @@ -5,10 +5,10 @@ # Uncomment the line with the branch you want to build the SDcard from: # @rootzoll master branch: -# wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build_sdcard.sh && sudo bash build_sdcard.sh +wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/build_sdcard.sh && sudo bash build_sdcard.sh # @rootzoll dev branch: -wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/build_sdcard.sh && sudo bash build_sdcard.sh dev +# wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/build_sdcard.sh && sudo bash build_sdcard.sh dev # @openoms DietPi branch: # wget https://raw.githubusercontent.com/openoms/raspiblitz/DietPi/build_sdcard.sh && sudo bash build_sdcard.sh DietPi openoms \ No newline at end of file diff --git a/dietpi/boot/dietpi.txt b/alternative.platforms/dietpi/boot/dietpi.txt similarity index 100% rename from dietpi/boot/dietpi.txt rename to alternative.platforms/dietpi/boot/dietpi.txt diff --git a/dietpi/boot/dietpi.txt.sample b/alternative.platforms/dietpi/boot/dietpi.txt.sample similarity index 100% rename from dietpi/boot/dietpi.txt.sample rename to alternative.platforms/dietpi/boot/dietpi.txt.sample diff --git a/dietpi/pictures/DroidBlitz.jpg b/alternative.platforms/dietpi/pictures/DroidBlitz.jpg similarity index 100% rename from dietpi/pictures/DroidBlitz.jpg rename to alternative.platforms/dietpi/pictures/DroidBlitz.jpg diff --git a/dietpi/pictures/HDD_copy_example.jpg b/alternative.platforms/dietpi/pictures/HDD_copy_example.jpg similarity index 100% rename from dietpi/pictures/HDD_copy_example.jpg rename to alternative.platforms/dietpi/pictures/HDD_copy_example.jpg diff --git a/dietpi/pictures/adapterHDD_HC1.jpg b/alternative.platforms/dietpi/pictures/adapterHDD_HC1.jpg similarity index 100% rename from dietpi/pictures/adapterHDD_HC1.jpg rename to alternative.platforms/dietpi/pictures/adapterHDD_HC1.jpg diff --git a/dietpi/pictures/bash_prompt.png b/alternative.platforms/dietpi/pictures/bash_prompt.png similarity index 100% rename from dietpi/pictures/bash_prompt.png rename to alternative.platforms/dietpi/pictures/bash_prompt.png diff --git a/dietpi/pictures/dietpi-software_exit.png b/alternative.platforms/dietpi/pictures/dietpi-software_exit.png similarity index 100% rename from dietpi/pictures/dietpi-software_exit.png rename to alternative.platforms/dietpi/pictures/dietpi-software_exit.png diff --git a/dietpi/pictures/dietpi_1st_reboot.png b/alternative.platforms/dietpi/pictures/dietpi_1st_reboot.png similarity index 100% rename from dietpi/pictures/dietpi_1st_reboot.png rename to alternative.platforms/dietpi/pictures/dietpi_1st_reboot.png diff --git a/alternative.platforms/display.alternatives.sh b/alternative.platforms/display.alternatives.sh new file mode 100644 index 000000000..474df8c4e --- /dev/null +++ b/alternative.platforms/display.alternatives.sh @@ -0,0 +1,137 @@ +# To run this script on your RaspiBlitz, copy the following line to the ssh terminal (after the #): +# wget https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/display.alternatives.sh && sudo bash display.alternatives.sh + +echo "Detect Base Image ..." +baseImage="?" +isDietPi=$(uname -n | grep -c 'DietPi') +isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') +isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') +isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu') +if [ ${isRaspbian} -gt 0 ]; then + baseImage="raspbian" +fi +if [ ${isArmbian} -gt 0 ]; then + baseImage="armbian" +fi +if [ ${isUbuntu} -gt 0 ]; then +baseImage="ubuntu" +fi +if [ ${isDietPi} -gt 0 ]; then + baseImage="dietpi" +fi +if [ "${baseImage}" = "?" ]; then + cat /etc/os-release 2>/dev/null + echo "!!! FAIL !!!" + echo "Base Image cannot be detected or is not supported." + exit 1 +else + echo "OK running ${baseImage}" +fi + + +OPTIONS=(GPIO "Install the default display available from Amazon" \ + HDMI "Install the 3.5\" HDMI display from Aliexpress" \ + SWISS "Install the Swiss version from play-zone.ch" +) +CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + +if [ "${CHOICE}" = "GPIO" ]; then + # *** RASPIBLITZ / LCD (at last - because makes a reboot) *** + # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip + # revert font change + # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ + sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup + sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup + + cd /home/admin/ + rm -r LCD-show + git clone https://github.com/goodtft/LCD-show.git + sudo chmod -R 755 LCD-show + sudo chown -R admin:admin LCD-show + cd LCD-show/ + + if [ "${baseImage}" != "dietpi" ]; then + echo "--> LCD DEFAULT" + sudo apt-mark hold raspberrypi-bootloader + sudo ./LCD35-show + else + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf + sudo mkdir /etc/X11/xorg.conf.d + sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/ + sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/tft35a.dtbo + sudo cp -rf ./usr/99-calibration.conf-35 /etc/X11/xorg.conf.d/99-calibration.conf + sudo cp -rf ./usr/99-fbturbo.conf /usr/share/X11/xorg.conf.d/ + sudo cp ./usr/cmdline.txt /DietPi/ + sudo cp ./usr/inittab /etc/ + sudo cp ./boot/config-35.txt /DietPi/config.txt + echo "***" + echo "reboot with \`sudo reboot\` to make the LCD work" + echo "***" + exit + fi + +elif [ "${CHOICE}" = "HDMI" ]; then + echo "Installing the 3.5\" HDMI display from Aliexpress" + + # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B + rm -r LCD-show + git clone https://github.com/goodtft/LCD-show.git + sudo chmod -R 755 LCD-show + cd LCD-show/ + #sudo ./MPI3508-show + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf + + if [ "${baseImage}" != "dietpi" ]; then + sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt + sudo cp ./usr/cmdline.txt /boot/ + else + sudo cp -rf ./boot/config-35-480X320.txt /DietPi/config.txt + sudo cp ./usr/cmdline.txt /DietPi/ + fi + sudo cp ./usr/inittab /etc/ + sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf + sudo mkdir -p /etc/X11/xorg.conf.d + sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf + # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ + sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup + sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup + echo "***" + echo "reboot with \`sudo reboot\` to make the LCD work" + echo "***" + exit + +elif [ "${CHOICE}" = "SWISS" ]; then + # Download and install the driver + # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps + echo "--> LCD ALTERNATIVE" + if [ "${baseImage}" != "dietpi" ]; then + cd /boot + else + cd /DietPi + fi + sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin + sudo mv dt-blob-For-3B-plus.bin dt-blob.bin + cat <> config.txt +dtparam=spi=off +dtparam=i2c_arm=off +# Set screen size and any overscan required +overscan_left=0 +overscan_right=0 +overscan_top=0 +overscan_bottom=0 +framebuffer_width=800 +framebuffer_height=480 +enable_dpi_lcd=1 +display_default_lcd=1 +dpi_group=2 +dpi_mode=87 +dpi_output_format=0x6f015 +# set up the size to 800x480 +hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 +#rotate screen +display_rotate=3 +dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 +fi +EOF + init 6 +fi \ No newline at end of file diff --git a/build_sdcard.sh b/build_sdcard.sh index f4127c32a..0fd291f54 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -41,12 +41,14 @@ echo "" echo "*** CHECK BASE IMAGE ***" # armv7=32Bit , armv8=64Bit -echo "Check if Linux ARM based ..." +echo "Detect CPU architecture ..." isARM=$(uname -m | grep -c 'arm') isAARCH64=$(uname -m | grep -c 'aarch64') -if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] ; then +isX86_64=$(uname -m | grep -c 'x86_64') +isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786') +if [ ${isARM} -eq 0 ] && [ ${isAARCH64} -eq 0 ] && [ ${isX86_64} -eq 0 ] && [ ${isX86_32} -eq 0 ] ; then echo "!!! FAIL !!!" - echo "Can only build on ARM or aarch64, not on:" + echo "Can only build on ARM, aarch64, x86_64 or i386 not on:" uname -m exit 1 else @@ -338,24 +340,41 @@ sudo sed --in-place -i "23s/.*/session required pam_limits.so/" /etc/pam.d/commo sudo sed --in-place -i "25s/.*/session required pam_limits.so/" /etc/pam.d/common-session-noninteractive sudo bash -c "echo '# end of pam-auth-update config' >> /etc/pam.d/common-session-noninteractive" -echo "" -echo "*** BITCOIN ***" +# "*** BITCOIN ***" # based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_30_bitcoin.md#installation # set version (change if update is available) +# https://bitcoincore.org/en/download/ +# bitcoinVersion="0.18.0" # commented out checksums for this version until lnd version >0.5.1 bitcoinVersion="0.17.1" -# set OS version +# set OS version and checksum +# needed to make sure download is not changed +# calculate with sha256sum and also check with SHA256SUMS.asc +# https://bitcoincore.org/bin/bitcoin-core-0.18.0/SHA256SUMS.asc if [ ${isARM} -eq 1 ] ; then bitcoinOSversion="arm-linux-gnueabihf" - # needed to make sure download is not changed - # calulate with sha256sum and also check with SHA256SUMS.asc + # bitcoinSHA256="3d7eb57290b2f14c495a24ecbab8100b35861f0c81bc10d86e5c0a8ec8284b27" bitcoinSHA256="aab3c1fb92e47734fadded1d3f9ccf0ac5a59e3cdc28c43a52fcab9f0cb395bc" fi if [ ${isAARCH64} -eq 1 ] ; then bitcoinOSversion="aarch64-linux-gnu" + # bitcoinSHA256="bfc3b8fddbb7ab9b532c9866859fc507ec959bdb82954966f54c8ebf8c7bb53b" bitcoinSHA256="5659c436ca92eed8ef42d5b2d162ff6283feba220748f9a373a5a53968975e34" fi +if [ ${isX86_64} -eq 1 ] ; then + bitcoinOSversion="x86_64-linux-gnu" + # bitcoinSHA256="5146ac5310133fbb01439666131588006543ab5364435b748ddfc95a8cb8d63f" + bitcoinSHA256="53ffca45809127c9ba33ce0080558634101ec49de5224b2998c489b6d0fc2b17" +fi +if [ ${isX86_32} -eq 1 ] ; then + bitcoinOSversion="i686-pc-linux-gnu" + # bitcoinSHA256="36ce9ffb375f6ee280df5a86e61038e3c475ab9dee34f6f89ea82b65a264183b" + bitcoinSHA256="b1e1dcf8265521fef9021a9d49d8661833e3f844ca9a410a9dd12a617553dda1" +fi + +echo "" +echo "*** BITCOIN v${bitcoinVersion} for ${bitcoinOSversion} ***" # needed to check code signing laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964" @@ -427,51 +446,62 @@ if [ ${installed} -lt 1 ]; then exit 1 fi -echo "" -echo "*** LITECOIN ***" -# based on https://medium.com/@jason.hcwong/litecoin-lightning-with-raspberry-pi-3-c3b931a82347 - -# set version (change if update is available) -litecoinVersion="0.16.3" -litecoinSHA256="fc6897265594985c1d09978b377d51a01cc13ee144820ddc59fbb7078f122f99" -cd /home/admin/download - -# download -binaryName="litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz" -sudo -u admin wget https://download.litecoin.org/litecoin-${litecoinVersion}/linux/${binaryName} - -# check download -binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) -if [ "${binaryChecksum}" != "${litecoinSHA256}" ]; then - echo "!!! FAIL !!! Downloaded LITECOIN BINARY not matching SHA256 checksum: ${litecoinSHA256}" - exit 1 -fi - -# install -sudo -u admin tar -xvf ${binaryName} -sudo install -m 0755 -o root -g root -t /usr/local/bin litecoin-${litecoinVersion}/bin/* -installed=$(sudo -u admin litecoind --version | grep "${litecoinVersion}" -c) -if [ ${installed} -lt 1 ]; then +if [ "${baseImage}" = "raspbian" ]; then echo "" - echo "!!! BUILD FAILED --> Was not able to install litecoind version(${litecoinVersion})" - exit 1 + echo "*** LITECOIN ***" + # based on https://medium.com/@jason.hcwong/litecoin-lightning-with-raspberry-pi-3-c3b931a82347 + + # set version (change if update is available) + litecoinVersion="0.16.3" + litecoinSHA256="fc6897265594985c1d09978b377d51a01cc13ee144820ddc59fbb7078f122f99" + cd /home/admin/download + + # download + binaryName="litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz" + sudo -u admin wget https://download.litecoin.org/litecoin-${litecoinVersion}/linux/${binaryName} + + # check download + binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1) + if [ "${binaryChecksum}" != "${litecoinSHA256}" ]; then + echo "!!! FAIL !!! Downloaded LITECOIN BINARY not matching SHA256 checksum: ${litecoinSHA256}" + exit 1 + fi + + # install + sudo -u admin tar -xvf ${binaryName} + sudo install -m 0755 -o root -g root -t /usr/local/bin litecoin-${litecoinVersion}/bin/* + installed=$(sudo -u admin litecoind --version | grep "${litecoinVersion}" -c) + if [ ${installed} -lt 1 ]; then + echo "" + echo "!!! BUILD FAILED --> Was not able to install litecoind version(${litecoinVersion})" + exit 1 + fi fi -echo "" -echo "*** LND ***" - +# "*** LND ***" ## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd ## see LND releases: https://github.com/lightningnetwork/lnd/releases -lndVersion="0.6-beta" +lndVersion="0.6.1-beta" if [ ${isARM} -eq 1 ] ; then lndOSversion="armv7" - lndSHA256="effea372c207293fd42b0cc27800da3a70c22f8c9a0e7b5eb8dbe56b5b98e1a3" + lndSHA256="5541959c7fde98d76d88cc8070ca626c681ba38c44afcb85bf417a9a677e23c2" fi if [ ${isAARCH64} -eq 1 ] ; then lndOSversion="arm64" - lndSHA256="2f31b13a4da6217ed7e27a44e1705103d7ed846aa2f599b7e5de0e6033a66c19" + lndSHA256="d5f7280c324ebc1d322435a0eac4c42dca73ebc6a613878d9e0d33a68276da5c" fi +if [ ${isX86_64} -eq 1 ] ; then + lndOSversion="amd64" + lndSHA256="c55367edb82955dc942baf9f48f79fadde1eee0e86c1d59d2fe1993140ec1b3f" +fi +if [ ${isX86_32} -eq 1 ] ; then + lndOSversion="386" + lndSHA256="00a7cd0ca657bb242b0f3acb5f4e26a13fd789946fab73c252118e3f89c1cf57" +fi + +echo "" +echo "*** LND v${lndVersion} for ${lndOSversion} ***" # olaoluwa PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" @@ -534,22 +564,41 @@ fi # echo "" echo "*** LND API for Python ***" -sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2 -sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1 +sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 3 +sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2 +sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 echo "to switch between python2/3: sudo update-alternatives --config python" sudo apt-get -f -y install virtualenv -sudo -u admin bash -c "cd; virtualenv python-env-lnd; source /home/admin/python-env-lnd/bin/activate; pip install grpcio grpcio-tools googleapis-common-protos pathlib2" +sudo -u admin bash -c "cd; sudo virtualenv python-env-lnd; source /home/admin/python-env-lnd/bin/activate; sudo pip install grpcio grpcio-tools googleapis-common-protos pathlib2" echo "" +# "*** Installing Go ***" # Go is needed for ZAP connect later -echo "*** Installing Go ***" -wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz -if [ ! -f "./go1.11.linux-armv6l.tar.gz" ] +# see https://golang.org/dl/ +goVersion="1.12.5" +if [ ${isARM} -eq 1 ] ; then + goOSversion="armv6l" +fi +if [ ${isAARCH64} -eq 1 ] ; then + goOSversion="arm64" +fi +if [ ${isX86_64} -eq 1 ] ; then + goOSversion="amd64" +fi +if [ ${isX86_32} -eq 1 ] ; then + goOSversion="386" +fi + +echo "*** Installing Go v${goVersion} for ${goOSversion} ***" + +# wget https://storage.googleapis.com/golang/go${goVersion}.linux-${goOSversion}.tar.gz +wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz +if [ ! -f "./go${goVersion}.linux-${goOSversion}.tar.gz" ] then echo "!!! FAIL !!! Download not success." exit 1 fi -sudo tar -C /usr/local -xzf go1.11.linux-armv6l.tar.gz +sudo tar -C /usr/local -xzf go${goVersion}.linux-${goOSversion}.tar.gz sudo rm *.gz sudo mkdir /usr/local/gocode sudo chmod 777 /usr/local/gocode diff --git a/dietpi/dietpi.display.sh b/dietpi/dietpi.display.sh deleted file mode 100644 index 37a9fdb4e..000000000 --- a/dietpi/dietpi.display.sh +++ /dev/null @@ -1,210 +0,0 @@ -# To run this script on your RaspiBlitz, copy the following line to the ssh terminal (after the #): -# wget https://raw.githubusercontent.com/openoms/raspiblitz/DietPi/dietpi/dietpi.display.sh && sudo chmod +x dietpi.display.sh && ./dietpi.display.sh - -# keep in mind that DietPi for Raspberry is also a stripped down Raspbian -echo "Detect Base Image ..." -baseImage="?" -isDietPi=$(uname -n | grep -c 'DietPi') -isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') -if [ ${isRaspbian} -gt 0 ]; then - baseImage="raspbian" -fi -if [ ${isDietPi} -gt 0 ]; then - baseImage="dietpi" -fi -if [ "${baseImage}" = "?" ]; then - cat /etc/os-release 2>/dev/null - echo "!!! FAIL !!!" - echo "Base Image cannot be detected or is not supported." - exit 1 -else - echo "OK running ${baseImage}" -fi - - -if [ "${baseImage}" = "raspbian" ]; then - echo "Press ENTER to install LCD and reboot ..." - read key - - # give Raspi a default hostname (optional) - sudo raspi-config nonint do_hostname "RaspiBlitz" - - # *** 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 - defaultDisplay=$? - - if [ "${defaultDisplay}" = "0" ]; then - - # *** RASPIBLITZ / LCD (at last - because makes a reboot) *** - # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip - - echo "--> LCD DEFAULT" - cd /home/admin/ - sudo apt-mark hold raspberrypi-bootloader - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - sudo chown -R admin:admin LCD-show - cd LCD-show/ - sudo ./LCD35-show - - else - - # Download and install the driver - # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps - - echo "--> LCD ALTERNATIVE" - cd /boot - sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin - sudo mv dt-blob-For-3B-plus.bin dt-blob.bin - cat <> config.txt - - dtparam=spi=off - dtparam=i2c_arm=off - - # Set screen size and any overscan required - overscan_left=0 - overscan_right=0 - overscan_top=0 - overscan_bottom=0 - framebuffer_width=800 - framebuffer_height=480 - - - enable_dpi_lcd=1 - display_default_lcd=1 - dpi_group=2 - dpi_mode=87 - dpi_output_format=0x6f015 - - # set up the size to 800x480 - hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 - - #rotate screen - display_rotate=3 - - dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 - fi -EOF - init 6 - fi -fi - - -if [ "${baseImage}" = "dietpi" ]; then - - OPTIONS=(GPIO "Install the default display available from Amazon" \ - HDMI "Install the 3.5\" HDMI display from Aliexpress" \ - SWISS "Install the Swiss version from play-zone.ch" - ) - - CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) - - if [ "${CHOICE}" = "GPIO" ]; then - echo "Installing the default display available from Amazon" - - # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip - cd /home/admin/ - #sudo apt-mark hold raspberrypi-bootloader - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - sudo chown -R admin:admin LCD-show - cd LCD-show/ - # sudo ./LCD35-show - sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf - sudo mkdir /etc/X11/xorg.conf.d - sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/ - sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/tft35a.dtbo - sudo cp -rf ./usr/99-calibration.conf-35 /etc/X11/xorg.conf.d/99-calibration.conf - sudo cp -rf ./usr/99-fbturbo.conf /usr/share/X11/xorg.conf.d/ - sudo cp ./usr/cmdline.txt /DietPi/ - sudo cp ./usr/inittab /etc/ - sudo cp ./boot/config-35.txt /DietPi/config.txt - - # revert font change - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup - - echo "***" - echo "reboot with \`sudo reboot\` to make the LCD work" - echo "***" - - exit - - elif [ "${CHOICE}" = "HDMI" ]; then - echo "Installing the 3.5\" HDMI display from Aliexpress" - - # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - cd LCD-show/ - #sudo ./MPI3508-show - sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf - sudo cp -rf ./boot/config-35-480X320.txt /DietPi/config.txt - sudo cp ./usr/cmdline.txt /DietPi/ - sudo cp ./usr/inittab /etc/ - sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf - sudo mkdir -p /etc/X11/xorg.conf.d - sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf - - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup - - echo "***" - echo "reboot with \`sudo reboot\` to make the LCD work" - echo "***" - - exit - - elif [ "${CHOICE}" = "SWISS" ]; then - - # Download and install the driver - # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps - - echo "--> LCD ALTERNATIVE" - - # revert font change - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup - - cd /DietPi - sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin - sudo mv dt-blob-For-3B-plus.bin dt-blob.bin - cat <> config.txt - - dtparam=spi=off - dtparam=i2c_arm=off - - # Set screen size and any overscan required - overscan_left=0 - overscan_right=0 - overscan_top=0 - overscan_bottom=0 - framebuffer_width=800 - framebuffer_height=480 - - - enable_dpi_lcd=1 - display_default_lcd=1 - dpi_group=2 - dpi_mode=87 - dpi_output_format=0x6f015 - - # set up the size to 800x480 - hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 - - #rotate screen - display_rotate=3 - - dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 - fi -EOF - init 6 - fi - -else - echo "CANCEL" - exit -fi \ No newline at end of file diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index 218196eef..20988d4d4 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -49,8 +49,11 @@ lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net" # get uptime & load load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2) -# get CPU temp -cpu=$(cat /sys/class/thermal/thermal_zone0/temp) +# get CPU temp - no measurement in a VM +cpu=0 +if [ -d "/sys/class/thermal/thermal_zone0/" ]; then + cpu=$(cat /sys/class/thermal/thermal_zone0/temp) +fi tempC=$((cpu/1000)) tempF=$(((cpu/1000) * (9/5) + 32)) @@ -75,9 +78,9 @@ else fi # get network traffic -# ifconfig does not show eth0 on Armbian - get first traffic info +# ifconfig does not show eth0 on Armbian or in a VM - get first traffic info isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') -if [ ${isArmbian} -gt 0 ]; then +if [ ${isArmbian} -gt 0 ] || [ ! -d "/sys/class/thermal/thermal_zone0/" ]; then network_rx=$(ifconfig | grep -m1 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g') network_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g') else diff --git a/home.admin/00raspiblitz.sh b/home.admin/00raspiblitz.sh index 5dd68ebe9..27d7c4624 100755 --- a/home.admin/00raspiblitz.sh +++ b/home.admin/00raspiblitz.sh @@ -306,18 +306,26 @@ if [ ${setupStep} -eq 0 ]; then HEIGHT=11 else + isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') + if [ ${isRaspbian} -gt 0 ]; then + # show hardware test + /home/admin/05hardwareTest.sh - # show hardware test - /home/admin/05hardwareTest.sh - - # start setup - BACKTITLE="RaspiBlitz - Setup" - TITLE="⚡ Welcome to your RaspiBlitz ⚡" - MENU="\nChoose how you want to setup your RaspiBlitz: \n " - OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \ - LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" ) - HEIGHT=11 - + # start setup + BACKTITLE="RaspiBlitz - Setup" + TITLE="⚡ Welcome to your RaspiBlitz ⚡" + MENU="\nChoose how you want to setup your RaspiBlitz: \n " + OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \ + LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" ) + HEIGHT=11 + else + # start setup + BACKTITLE="RaspiBlitz - Setup" + TITLE="⚡ Welcome to your RaspiBlitz ⚡" + MENU="\nStart to setup your RaspiBlitz: \n " + OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning") + HEIGHT=10 + fi fi elif [ ${setupStep} -lt 100 ]; then diff --git a/home.admin/30initHDD.sh b/home.admin/30initHDD.sh index 5fbd5c2a2..454243f06 100755 --- a/home.admin/30initHDD.sh +++ b/home.admin/30initHDD.sh @@ -14,19 +14,25 @@ if [ ${existsHDD} -eq 1 ]; then # check if there is s sda2 existsHDD2=$(lsblk | grep -c sda2) - if [ ${existsHDD2} -eq 1 ]; then - echo "OK - HDD found at sda2 ... determine which is bigger" + hddSecondDriveExists=$(lsblk | grep -c sdb) + if [ ${existsHDD2} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then + echo "OK - another HDD found at sdb ... determine which is bigger" # get both with size size1=$(lsblk -o NAME,SIZE -b | grep "sda1" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) echo "sda1(${size1})" size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) echo "sda2(${size2})" + size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs) + echo "sdb(${size3})" - # chosse to run with the bigger one + # choose to run with the bigger one if [ ${size2} -gt ${size1} ]; then echo "sda2 is BIGGER - run with this one" device="sda2" + elif [ ${size3} -gt ${size1} ]; then + echo "sdb is BIGGER - run with this one" + device="sdb" else echo "sda1 is BIGGER - run with this one" fi diff --git a/home.admin/97addMobileWalletLNDconnect.sh b/home.admin/97addMobileWalletLNDconnect.sh index 23ab6faec..e548c4c73 100755 --- a/home.admin/97addMobileWalletLNDconnect.sh +++ b/home.admin/97addMobileWalletLNDconnect.sh @@ -32,12 +32,37 @@ goVersion="1.11" echo "### Check Framework: GO ###" goInstalled=$(go version 2>/dev/null | grep -c 'go') if [ ${goInstalled} -eq 0 ];then - echo "---> Installing GO" - wget https://storage.googleapis.com/golang/go${goVersion}.linux-armv6l.tar.gz - sudo tar -C /usr/local -xzf go${goVersion}.linux-armv6l.tar.gz + goVersion="1.12.5" + if [ ${isARM} -eq 1 ] ; then + goOSversion="armv6l" + fi + if [ ${isAARCH64} -eq 1 ] ; then + goOSversion="arm64" + fi + if [ ${isX86_64} -eq 1 ] ; then + goOSversion="amd64" + fi + if [ ${isX86_32} -eq 1 ] ; then + goOSversion="386" + fi + + echo "*** Installing Go v${goVersion} for ${goOSversion} ***" + + # wget https://storage.googleapis.com/golang/go${goVersion}.linux-${goOSversion}.tar.gz + wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz + if [ ! -f "./go${goVersion}.linux-${goOSversion}.tar.gz" ] + then + echo "!!! FAIL !!! Download not success." + exit 1 + fi + sudo tar -C /usr/local -xzf go${goVersion}.linux-${goOSversion}.tar.gz sudo rm *.gz sudo mkdir /usr/local/gocode sudo chmod 777 /usr/local/gocode + export GOROOT=/usr/local/go + export PATH=$PATH:$GOROOT/bin + export GOPATH=/usr/local/gocode + export PATH=$PATH:$GOPATH/bin goInstalled=$(go version 2>/dev/null | grep -c 'go') fi if [ ${goInstalled} -eq 0 ];then diff --git a/home.admin/97addMobileWalletZeus.sh b/home.admin/97addMobileWalletZeus.sh index cf2497c3d..d2304e05b 100644 --- a/home.admin/97addMobileWalletZeus.sh +++ b/home.admin/97addMobileWalletZeus.sh @@ -17,12 +17,37 @@ fi # make sure go is installed goInstalled=$(go version 2>/dev/null | grep -c 'go') if [ ${goInstalled} -eq 0 ];then - echo "### Installing GO ###" - wget https://storage.googleapis.com/golang/go1.11.linux-armv6l.tar.gz - sudo tar -C /usr/local -xzf go1.11.linux-armv6l.tar.gz + goVersion="1.12.5" + if [ ${isARM} -eq 1 ] ; then + goOSversion="armv6l" + fi + if [ ${isAARCH64} -eq 1 ] ; then + goOSversion="arm64" + fi + if [ ${isX86_64} -eq 1 ] ; then + goOSversion="amd64" + fi + if [ ${isX86_32} -eq 1 ] ; then + goOSversion="386" + fi + + echo "*** Installing Go v${goVersion} for ${goOSversion} ***" + + # wget https://storage.googleapis.com/golang/go${goVersion}.linux-${goOSversion}.tar.gz + wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz + if [ ! -f "./go${goVersion}.linux-${goOSversion}.tar.gz" ] + then + echo "!!! FAIL !!! Download not success." + exit 1 + fi + sudo tar -C /usr/local -xzf go${goVersion}.linux-${goOSversion}.tar.gz sudo rm *.gz sudo mkdir /usr/local/gocode sudo chmod 777 /usr/local/gocode + export GOROOT=/usr/local/go + export PATH=$PATH:$GOROOT/bin + export GOPATH=/usr/local/gocode + export PATH=$PATH:$GOPATH/bin goInstalled=$(go version 2>/dev/null | grep -c 'go') fi if [ ${goInstalled} -eq 0 ];then diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index de27af608..e71d944a3 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -148,17 +148,23 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then # detect for correct device name (the biggest partition) hddDeviceName="sda1" hddSecondPartitionExists=$(lsblk | grep -c sda2) - if [ ${hddSecondPartitionExists} -eq 1 ]; then + hddSecondDriveExists=$(lsblk | grep -c sdb) + if [ ${hddSecondPartitionExists} -eq 1 ] || [ ${hddSecondDriveExists} -eq 1 ] ; then echo "HDD has a second partition - choosing the bigger one ..." >> $logFile # get both with size size1=$(lsblk -o NAME,SIZE -b | grep "sda1" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) echo "sda1(${size1})" >> $logFile size2=$(lsblk -o NAME,SIZE -b | grep "sda2" | awk '{ print substr( $0, 12, length($0)-2 ) }' | xargs) echo "sda2(${size2})" >> $logFile - # chosse to run with the bigger one + size3=$(lsblk -o NAME,SIZE -b | grep "sdb" | awk '{ print substr( $0, 8, length($0)-2 ) }' | xargs) + echo "sdb(${size3})" >> $logFile + # choose to run with the bigger one if [ ${size2} -gt ${size1} ]; then echo "sda2 is BIGGER - run with this one" >> $logFile hddDeviceName="sda2" + elif [ ${size3} -gt ${size1} ]; then + echo "sdb is BIGGER - run with this one" >> $logFile + hddDeviceName="sdb" else echo "sda1 is BIGGER - run with this one" >> $logFile hddDeviceName="sda1" @@ -469,13 +475,38 @@ sudo rm /mnt/hdd/${network}/debug.log 2>/dev/null sudo rm /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null ################################ -# STRESSTEST HARDWARE +# RECORD BASEIMAGE ################################ -# generate stresstest report on every startup (in case hardware has changed) -sed -i "s/^state=.*/state=stresstest/g" ${infoFile} -sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile} -sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.report +baseImage="?" +isDietPi=$(uname -n | grep -c 'DietPi') +isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') +isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') +isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu') +if [ ${isRaspbian} -gt 0 ]; then + baseImage="raspbian" +fi +if [ ${isArmbian} -gt 0 ]; then + baseImage="armbian" +fi +if [ ${isUbuntu} -gt 0 ]; then +baseImage="ubuntu" +fi +if [ ${isDietPi} -gt 0 ]; then + baseImage="dietpi" +fi +echo "baseimage=${baseImage}" >> $infoFile -echo "DONE BOOTSTRAP" >> $logFile -exit 0 \ No newline at end of file +################################ +# STRESSTEST RASPBERRY PI +################################ + +if [ "${baseImage}" = "raspbian" ] ; then + # generate stresstest report on every startup (in case hardware has changed) + sed -i "s/^state=.*/state=stresstest/g" ${infoFile} + sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile} + sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.report + + echo "DONE BOOTSTRAP" >> $logFile + exit 0 +fi \ No newline at end of file diff --git a/home.admin/config.scripts/blitz.statusscan.sh b/home.admin/config.scripts/blitz.statusscan.sh index 8342a0e31..29284bf8a 100644 --- a/home.admin/config.scripts/blitz.statusscan.sh +++ b/home.admin/config.scripts/blitz.statusscan.sh @@ -20,9 +20,12 @@ sudo chmod 777 -R /mnt/hdd/temp 2>/dev/null localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') echo "localIP='${localip}'" -# temp -tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc) -echo "tempCelsius='${tempC}'" +# temp - no measurement in a VM +tempC=0 +if [ -d "/sys/class/thermal/thermal_zone0/" ]; then + tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc) + echo "tempCelsius='${tempC}'" +fi # uptime in seconds uptime=$(awk '{printf("%d\n",$1 + 0.5)}' /proc/uptime) diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index 799bba689..079af9ed7 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -51,7 +51,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.2.16 + git reset --hard v0.3.2 # check if node_modles exists now if [ -d "/home/admin/RTL" ]; then echo "OK - RTL code copy looks good" @@ -134,4 +134,4 @@ fi echo "FAIL - Unknown Paramter $1" echo "may needs reboot to run normal again" -exit 1 \ No newline at end of file +exit 1