#2126 fix sd card expand & #1888 static fallback list (#2132)

This commit is contained in:
/rootzoll 2021-04-03 12:24:50 +02:00 committed by GitHub
parent b44ec9f2a2
commit 9da5eb879b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 143981 additions and 176 deletions

View File

@ -2,30 +2,30 @@
# wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/display.alternatives.sh && sudo bash display.alternatives.sh # wget https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/display.alternatives.sh && sudo bash display.alternatives.sh
echo "Detect Base Image ..." echo "Detect Base Image ..."
baseImage="?" baseimage="?"
isDietPi=$(uname -n | grep -c 'DietPi') isDietPi=$(uname -n | grep -c 'DietPi')
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian')
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian')
isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu') isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu')
if [ ${isRaspbian} -gt 0 ]; then if [ ${isRaspbian} -gt 0 ]; then
baseImage="raspbian" baseimage="raspbian"
fi fi
if [ ${isArmbian} -gt 0 ]; then if [ ${isArmbian} -gt 0 ]; then
baseImage="armbian" baseimage="armbian"
fi fi
if [ ${isUbuntu} -gt 0 ]; then if [ ${isUbuntu} -gt 0 ]; then
baseImage="ubuntu" baseimage="ubuntu"
fi fi
if [ ${isDietPi} -gt 0 ]; then if [ ${isDietPi} -gt 0 ]; then
baseImage="dietpi" baseimage="dietpi"
fi fi
if [ "${baseImage}" = "?" ]; then if [ "${baseimage}" = "?" ]; then
cat /etc/os-release 2>/dev/null cat /etc/os-release 2>/dev/null
echo "!!! FAIL !!!" echo "!!! FAIL !!!"
echo "Base Image cannot be detected or is not supported." echo "Base Image cannot be detected or is not supported."
exit 1 exit 1
else else
echo "OK running ${baseImage}" echo "OK running ${baseimage}"
fi fi
@ -50,7 +50,7 @@ if [ "${CHOICE}" = "GPIO" ]; then
sudo chown -R admin:admin LCD-show sudo chown -R admin:admin LCD-show
cd LCD-show/ cd LCD-show/
if [ "${baseImage}" != "dietpi" ]; then if [ "${baseimage}" != "dietpi" ]; then
echo "--> LCD DEFAULT" echo "--> LCD DEFAULT"
sudo apt-mark hold raspberrypi-bootloader sudo apt-mark hold raspberrypi-bootloader
sudo ./LCD35-show sudo ./LCD35-show
@ -81,7 +81,7 @@ elif [ "${CHOICE}" = "HDMI" ]; then
#sudo ./MPI3508-show #sudo ./MPI3508-show
sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf
if [ "${baseImage}" != "dietpi" ]; then if [ "${baseimage}" != "dietpi" ]; then
sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt
sudo cp ./usr/cmdline.txt /boot/ sudo cp ./usr/cmdline.txt /boot/
else else
@ -104,7 +104,7 @@ elif [ "${CHOICE}" = "SWISS" ]; then
# Download and install the driver # Download and install the driver
# based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps
echo "--> LCD ALTERNATIVE" echo "--> LCD ALTERNATIVE"
if [ "${baseImage}" != "dietpi" ]; then if [ "${baseimage}" != "dietpi" ]; then
cd /boot cd /boot
else else
cd /DietPi cd /DietPi

View File

@ -122,38 +122,38 @@ echo "X) will use CPU-ARCHITECTURE --> '${cpu}'"
# AUTO-DETECTION: OPERATINGSYSTEM # AUTO-DETECTION: OPERATINGSYSTEM
# --------------------------------------- # ---------------------------------------
baseImage="?" baseimage="?"
isDietPi=$(uname -n | grep -c 'DietPi') isDietPi=$(uname -n | grep -c 'DietPi')
isRaspbian=$(grep -c 'Raspbian' /etc/os-release 2>/dev/null) isRaspbian=$(grep -c 'Raspbian' /etc/os-release 2>/dev/null)
isDebian=$(grep -c 'Debian' /etc/os-release 2>/dev/null) isDebian=$(grep -c 'Debian' /etc/os-release 2>/dev/null)
isUbuntu=$(grep -c 'Ubuntu' /etc/os-release 2>/dev/null) isUbuntu=$(grep -c 'Ubuntu' /etc/os-release 2>/dev/null)
isNvidia=$(uname -a | grep -c 'tegra') isNvidia=$(uname -a | grep -c 'tegra')
if [ ${isRaspbian} -gt 0 ]; then if [ ${isRaspbian} -gt 0 ]; then
baseImage="raspbian" baseimage="raspbian"
fi fi
if [ ${isDebian} -gt 0 ]; then if [ ${isDebian} -gt 0 ]; then
if [ $(uname -n | grep -c 'rpi') -gt 0 ] && [ ${isAARCH64} -gt 0 ]; then if [ $(uname -n | grep -c 'rpi') -gt 0 ] && [ ${isAARCH64} -gt 0 ]; then
baseImage="debian_rpi64" baseimage="debian_rpi64"
elif [ $(uname -n | grep -c 'raspberrypi') -gt 0 ] && [ ${isAARCH64} -gt 0 ]; then elif [ $(uname -n | grep -c 'raspberrypi') -gt 0 ] && [ ${isAARCH64} -gt 0 ]; then
baseImage="raspios_arm64" baseimage="raspios_arm64"
elif [ ${isAARCH64} -gt 0 ] || [ ${isARM} -gt 0 ] ; then elif [ ${isAARCH64} -gt 0 ] || [ ${isARM} -gt 0 ] ; then
baseImage="armbian" baseimage="armbian"
else else
baseImage="debian" baseimage="debian"
fi fi
fi fi
if [ ${isUbuntu} -gt 0 ]; then if [ ${isUbuntu} -gt 0 ]; then
baseImage="ubuntu" baseimage="ubuntu"
fi fi
if [ ${isDietPi} -gt 0 ]; then if [ ${isDietPi} -gt 0 ]; then
baseImage="dietpi" baseimage="dietpi"
fi fi
if [ "${baseImage}" = "?" ]; then if [ "${baseimage}" = "?" ]; then
cat /etc/os-release 2>/dev/null cat /etc/os-release 2>/dev/null
echo "!!! FAIL: Base Image cannot be detected or is not supported." echo "!!! FAIL: Base Image cannot be detected or is not supported."
exit 1 exit 1
fi fi
echo "X) will use OPERATINGSYSTEM ---> '${baseImage}'" echo "X) will use OPERATINGSYSTEM ---> '${baseimage}'"
# USER-CONFIRMATION # USER-CONFIRMATION
echo -n "Do you agree with all parameters above? (yes/no) " echo -n "Do you agree with all parameters above? (yes/no) "
@ -188,16 +188,16 @@ torSourceListAvailable=$(sudo grep -c 'https://deb.torproject.org/torproject.org
echo "torSourceListAvailable=${torSourceListAvailable}" echo "torSourceListAvailable=${torSourceListAvailable}"
if [ ${torSourceListAvailable} -eq 0 ]; then if [ ${torSourceListAvailable} -eq 0 ]; then
echo "- adding TOR sources ..." echo "- adding TOR sources ..."
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "raspios_arm64" ] || [ "${baseImage}" = "armbian" ] || [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "armbian" ] || [ "${baseimage}" = "dietpi" ]; then
echo "- using https://deb.torproject.org/torproject.org buster" echo "- using https://deb.torproject.org/torproject.org buster"
echo "deb https://deb.torproject.org/torproject.org buster main" | sudo tee -a /etc/apt/sources.list echo "deb https://deb.torproject.org/torproject.org buster main" | sudo tee -a /etc/apt/sources.list
echo "deb-src https://deb.torproject.org/torproject.org buster main" | sudo tee -a /etc/apt/sources.list echo "deb-src https://deb.torproject.org/torproject.org buster main" | sudo tee -a /etc/apt/sources.list
elif [ "${baseImage}" = "ubuntu" ]; then elif [ "${baseimage}" = "ubuntu" ]; then
echo "- using https://deb.torproject.org/torproject.org focal" echo "- using https://deb.torproject.org/torproject.org focal"
echo "deb https://deb.torproject.org/torproject.org focal main" | sudo tee -a /etc/apt/sources.list echo "deb https://deb.torproject.org/torproject.org focal main" | sudo tee -a /etc/apt/sources.list
echo "deb-src https://deb.torproject.org/torproject.org focal main" | sudo tee -a /etc/apt/sources.list echo "deb-src https://deb.torproject.org/torproject.org focal main" | sudo tee -a /etc/apt/sources.list
else else
echo "!!! FAIL: No Tor sources for os: ${baseImage}" echo "!!! FAIL: No Tor sources for os: ${baseimage}"
exit 1 exit 1
fi fi
echo "- OK sources added" echo "- OK sources added"
@ -213,8 +213,8 @@ echo ""
# https://github.com/rootzoll/raspiblitz/issues/138 # https://github.com/rootzoll/raspiblitz/issues/138
# https://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html # https://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html
# https://stackoverflow.com/questions/38188762/generate-all-locales-in-a-docker-image # https://stackoverflow.com/questions/38188762/generate-all-locales-in-a-docker-image
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ] || \ if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "dietpi" ] || \
[ "${baseImage}" = "raspios_arm64" ]||[ "${baseImage}" = "debian_rpi64" ]; then [ "${baseimage}" = "raspios_arm64" ]||[ "${baseimage}" = "debian_rpi64" ]; then
echo "" echo ""
echo "*** FIXING LOCALES FOR BUILD ***" echo "*** FIXING LOCALES FOR BUILD ***"
@ -223,7 +223,7 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ] || \
sudo locale-gen sudo locale-gen
export LANGUAGE=en_US.UTF-8 export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "dietpi" ]; then
export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.UTF-8
# https://github.com/rootzoll/raspiblitz/issues/684 # https://github.com/rootzoll/raspiblitz/issues/684
@ -268,7 +268,7 @@ sudo apt update -y
sudo apt upgrade -f -y sudo apt upgrade -f -y
echo "" echo ""
echo "*** PREPARE ${baseImage} ***" echo "*** PREPARE ${baseimage} ***"
# make sure the pi user is present # make sure the pi user is present
if [ "$(compgen -u | grep -c dietpi)" -gt 0 ];then if [ "$(compgen -u | grep -c dietpi)" -gt 0 ];then
@ -281,8 +281,8 @@ elif [ "$(compgen -u | grep -c pi)" -eq 0 ];then
fi fi
# special prepare when Raspbian # special prepare when Raspbian
if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "raspios_arm64" ]||\ if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
[ "${baseImage}" = "debian_rpi64" ]; then [ "${baseimage}" = "debian_rpi64" ]; then
sudo apt install -y raspi-config sudo apt install -y raspi-config
# do memory split (16MB) # do memory split (16MB)
sudo raspi-config nonint do_memory_split 16 sudo raspi-config nonint do_memory_split 16
@ -354,8 +354,8 @@ echo "root:raspiblitz" | sudo chpasswd
echo "pi:raspiblitz" | sudo chpasswd echo "pi:raspiblitz" | sudo chpasswd
if [ "${lcdInstalled}" != "false" ]; then if [ "${lcdInstalled}" != "false" ]; then
if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "raspios_arm64" ]||\ if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
[ "${baseImage}" = "debian_rpi64" ]; then [ "${baseimage}" = "debian_rpi64" ]; then
# set Raspi to boot up automatically with user pi (for the LCD) # set Raspi to boot up automatically with user pi (for the LCD)
# https://www.raspberrypi.org/forums/viewtopic.php?t=21632 # https://www.raspberrypi.org/forums/viewtopic.php?t=21632
sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_boot_behaviour B2
@ -364,14 +364,14 @@ if [ "${lcdInstalled}" != "false" ]; then
sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf"
fi fi
if [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "dietpi" ]; then
# set DietPi to boot up automatically with user pi (for the LCD) # set DietPi to boot up automatically with user pi (for the LCD)
# requires AUTO_SETUP_AUTOSTART_TARGET_INDEX=7 in the dietpi.txt # requires AUTO_SETUP_AUTOSTART_TARGET_INDEX=7 in the dietpi.txt
# /DietPi/dietpi/dietpi-autostart overwrites /etc/systemd/system/getty@tty1.service.d/dietpi-autologin.conf on reboot # /DietPi/dietpi/dietpi-autostart overwrites /etc/systemd/system/getty@tty1.service.d/dietpi-autologin.conf on reboot
sudo sed -i 's/agetty --autologin root %I $TERM/agetty --autologin pi --noclear %I 38400 linux/' /DietPi/dietpi/dietpi-autostart sudo sed -i 's/agetty --autologin root %I $TERM/agetty --autologin pi --noclear %I 38400 linux/' /DietPi/dietpi/dietpi-autostart
fi fi
if [ "${baseImage}" = "ubuntu" ] || [ "${baseImage}" = "armbian" ]; then if [ "${baseimage}" = "ubuntu" ] || [ "${baseimage}" = "armbian" ]; then
sudo bash -c "echo '[Service]' >> /lib/systemd/system/getty@.service" sudo bash -c "echo '[Service]' >> /lib/systemd/system/getty@.service"
sudo bash -c "echo 'ExecStart=' >> /lib/systemd/system/getty@.service" sudo bash -c "echo 'ExecStart=' >> /lib/systemd/system/getty@.service"
sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /lib/systemd/system/getty@.service" sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /lib/systemd/system/getty@.service"
@ -477,7 +477,7 @@ sudo apt install -y sysbench
sudo apt install -y build-essential sudo apt install -y build-essential
# add armbian-config # add armbian-config
if [ "${baseImage}" = "armbian" ]; then if [ "${baseimage}" = "armbian" ]; then
# add armbian config # add armbian config
sudo apt install armbian-config -y sudo apt install armbian-config -y
fi fi
@ -526,6 +526,12 @@ sudo chsh admin -s /bin/bash
# configure sudo for usage without password entry # configure sudo for usage without password entry
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo
# WRITE BASIC raspiblitz.info to sdcard
echo "baseimage=${baseimage}" > /home/admin/raspiblitz.info
echo "cpu=${cpu}" >> /home/admin/raspiblitz.info
sudo mv ./raspiblitz.info /home/admin/raspiblitz.info
sudo chmod 777 /home/admin/raspiblitz.info
echo "" echo ""
echo "*** ADDING SERVICE USER bitcoin" echo "*** ADDING SERVICE USER bitcoin"
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#adding-the-service-user-bitcoin # based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#adding-the-service-user-bitcoin
@ -562,8 +568,10 @@ sudo -H python3 -m pip install requests[socks]==2.21.0
echo "" echo ""
echo "*** SHELL SCRIPTS AND ASSETS ***" echo "*** SHELL SCRIPTS AND ASSETS ***"
# move files from gitclone # copy raspiblitz repo from github
cd /home/admin/ cd /home/admin/
sudo -u admin git config --global user.name "${githubUser}"
sudo -u admin git config --global user.email "johndoe@example.com"
sudo -u admin rm -rf /home/admin/raspiblitz sudo -u admin rm -rf /home/admin/raspiblitz
sudo -u admin git clone -b ${githubBranch} https://github.com/${githubUser}/raspiblitz.git sudo -u admin git clone -b ${githubBranch} https://github.com/${githubUser}/raspiblitz.git
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/*.* /home/admin sudo -u admin cp -r /home/admin/raspiblitz/home.admin/*.* /home/admin
@ -678,8 +686,8 @@ echo "Activating CACHE RAM DISK ... "
sudo /home/admin/config.scripts/blitz.cache.sh on sudo /home/admin/config.scripts/blitz.cache.sh on
# *** Wifi & Bluetooth *** # *** Wifi & Bluetooth ***
if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "raspios_arm64" ]||\ if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
[ "${baseImage}" = "debian_rpi64" ]; then [ "${baseimage}" = "debian_rpi64" ]; then
if [ "${modeWifi}" == "false" ]; then if [ "${modeWifi}" == "false" ]; then
echo "" echo ""
@ -723,15 +731,6 @@ if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "raspios_arm64" ]||\
fi fi
# *** FALLBACK NODE LIST *** see https://github.com/rootzoll/raspiblitz/issues/1888
echo "*** FALLBACK NODE LIST ***"
sudo -u admin curl -H "Accept: application/json; indent=4" https://bitnodes.io/api/v1/snapshots/latest/ -o /home/admin/fallback.nodes
byteSizeList=$(sudo -u admin stat -c %s /home/admin/fallback.nodes)
if [ ${#byteSizeList} -eq 0 ] || [ ${byteSizeList} -lt 1024 ]; then
echo "FAIL: downloading FALLBACK NODE LIST --> https://bitnodes.io/api/v1/snapshots/latest/"
exit 1
fi
# *** FATPACK *** (can be activated by parameter - see details at start of script) # *** FATPACK *** (can be activated by parameter - see details at start of script)
if [ "${fatpack}" == "true" ]; then if [ "${fatpack}" == "true" ]; then
echo "*** FATPACK ***" echo "*** FATPACK ***"
@ -758,6 +757,17 @@ if [ "${fatpack}" == "true" ]; then
sudo apt-get install -y hexyl sudo apt-get install -y hexyl
sudo apt-get install -y autossh sudo apt-get install -y autossh
# *** UPDATE FALLBACK NODE LIST (only as part of fatpack) *** see https://github.com/rootzoll/raspiblitz/issues/1888
echo "*** FALLBACK NODE LIST ***"
sudo -u admin curl -H "Accept: application/json; indent=4" https://bitnodes.io/api/v1/snapshots/latest/ -o /home/admin/fallback.nodes
byteSizeList=$(sudo -u admin stat -c %s /home/admin/fallback.nodes)
if [ ${#byteSizeList} -eq 0 ] || [ ${byteSizeList} -lt 10240 ]; then
echo "WARN: Failed downloading fresh FALLBACK NODE LIST --> https://bitnodes.io/api/v1/snapshots/latest/"
sudo rm /home/admin/fallback.nodes 2>/dev/null
sudo cp /home/admin/assets/fallback.nodes /home/admin/fallback.nodes
fi
sudo chown admin:admin /home/admin/fallback.nodes
else else
echo "* skipping FATPACK" echo "* skipping FATPACK"
fi fi
@ -1022,9 +1032,9 @@ echo "*** DISPLAY OPTIONS ***"
if [ "${lcdInstalled}" != "false" ]; then if [ "${lcdInstalled}" != "false" ]; then
# lcd preparations based on os # lcd preparations based on os
if [ "${baseImage}" = "raspbian" ]||[ "${baseImage}" = "raspios_arm64" ]||\ if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
[ "${baseImage}" = "debian_rpi64" ]||[ "${baseImage}" = "armbian" ]||\ [ "${baseimage}" = "debian_rpi64" ]||[ "${baseimage}" = "armbian" ]||\
[ "${baseImage}" = "ubuntu" ]; then [ "${baseimage}" = "ubuntu" ]; then
homeFile=/home/pi/.bashrc homeFile=/home/pi/.bashrc
autostart="automatic start the LCD" autostart="automatic start the LCD"
autostartDone=$(grep -c "$autostart" $homeFile) autostartDone=$(grep -c "$autostart" $homeFile)
@ -1041,7 +1051,7 @@ if [ "${lcdInstalled}" != "false" ]; then
echo "autostart LCD already in $homeFile" echo "autostart LCD already in $homeFile"
fi fi
fi fi
if [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "dietpi" ]; then
homeFile=/home/dietpi/.bashrc homeFile=/home/dietpi/.bashrc
startLCD="automatic start the LCD" startLCD="automatic start the LCD"
autostartDone=$(grep -c "$startLCD" $homeFile) autostartDone=$(grep -c "$startLCD" $homeFile)
@ -1059,7 +1069,7 @@ if [ "${lcdInstalled}" != "false" ]; then
echo "" echo ""
if [ "${lcdInstalled}" == "GPIO" ]; then if [ "${lcdInstalled}" == "GPIO" ]; then
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "dietpi" ]; then
echo "*** 32bit LCD DRIVER ***" echo "*** 32bit LCD DRIVER ***"
echo "--> Downloading LCD Driver from Github" echo "--> Downloading LCD Driver from Github"
cd /home/admin/ cd /home/admin/
@ -1073,7 +1083,7 @@ if [ "${lcdInstalled}" != "false" ]; then
sudo apt install -y libxi6 sudo apt install -y libxi6
sudo dpkg -i xinput-calibrator_0.7.5-1_armhf.deb sudo dpkg -i xinput-calibrator_0.7.5-1_armhf.deb
if [ "${baseImage}" = "dietpi" ]; then if [ "${baseimage}" = "dietpi" ]; then
echo "--> dietpi preparations" echo "--> dietpi preparations"
sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf
sudo mkdir /etc/X11/xorg.conf.d sudo mkdir /etc/X11/xorg.conf.d
@ -1087,7 +1097,7 @@ if [ "${lcdInstalled}" != "false" ]; then
# make LCD screen rotation correct # make LCD screen rotation correct
sudo sed -i "s/dtoverlay=tft35a/dtoverlay=tft35a:rotate=270/" /DietPi/config.txt sudo sed -i "s/dtoverlay=tft35a/dtoverlay=tft35a:rotate=270/" /DietPi/config.txt
fi fi
elif [ "${baseImage}" = "raspios_arm64" ] || [ "${baseImage}" = "debian_rpi64" ]; then elif [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "debian_rpi64" ]; then
echo "*** 64bit LCD DRIVER ***" echo "*** 64bit LCD DRIVER ***"
echo "--> Downloading LCD Driver from Github" echo "--> Downloading LCD Driver from Github"
cd /home/admin/ cd /home/admin/
@ -1136,9 +1146,11 @@ echo "SD CARD BUILD DONE"
echo "**********************************************" echo "**********************************************"
echo "" echo ""
sudo cat /home/admin/raspiblitz.info
if [ "${lcdInstalled}" != "false" ]; then if [ "${lcdInstalled}" != "false" ]; then
echo "Your SD Card Image for RaspiBlitz is almost ready." echo "Your SD Card Image for RaspiBlitz is almost ready."
if [ "${baseImage}" = "raspbian" ]; then if [ "${baseimage}" = "raspbian" ]; then
echo "Last step is to install LCD drivers. This will reboot your Pi when done." echo "Last step is to install LCD drivers. This will reboot your Pi when done."
echo "" echo ""
fi fi
@ -1159,12 +1171,14 @@ echo ""
if [ "${lcdInstalled}" == "GPIO" ]; then if [ "${lcdInstalled}" == "GPIO" ]; then
# activate LCD and trigger reboot # activate LCD and trigger reboot
# dont do this on dietpi to allow for automatic build # dont do this on dietpi to allow for automatic build
if [ "${baseImage}" = "raspbian" ]; then if [ "${baseimage}" = "raspbian" ]; then
echo "Installing 32-bit LCD drivers ..."
sudo chmod +x -R /home/admin/LCD-show sudo chmod +x -R /home/admin/LCD-show
cd /home/admin/LCD-show/ cd /home/admin/LCD-show/
sudo apt-mark hold raspberrypi-bootloader sudo apt-mark hold raspberrypi-bootloader
sudo ./LCD35-show sudo ./LCD35-show
elif [ "${baseImage}" = "raspios_arm64" ] || [ "${baseImage}" = "debian_rpi64" ]; then elif [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "debian_rpi64" ]; then
echo "Installing 64-bit LCD drivers ..."
sudo chmod +x -R /home/admin/wavesharelcd-64bit-rpi sudo chmod +x -R /home/admin/wavesharelcd-64bit-rpi
cd /home/admin/wavesharelcd-64bit-rpi cd /home/admin/wavesharelcd-64bit-rpi
sudo apt-mark hold raspberrypi-bootloader sudo apt-mark hold raspberrypi-bootloader

View File

@ -31,7 +31,7 @@ echo "Setting the Name/Alias/Hostname .."
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname} sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
# expanding the root of the sd card # expanding the root of the sd card
if [ "${baseimage}" = "raspbian" ]; then if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
sudo raspi-config --expand-rootfs sudo raspi-config --expand-rootfs
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info
elif [ "${baseimage}" = "armbian" ]; then elif [ "${baseimage}" = "armbian" ]; then

View File

@ -36,10 +36,6 @@ fi
# see: https://github.com/rootzoll/raspiblitz/issues/936 # see: https://github.com/rootzoll/raspiblitz/issues/936
echo "CHECK IF SD CARD NEEDS EXPANSION" >> ${logFile} echo "CHECK IF SD CARD NEEDS EXPANSION" >> ${logFile}
source ${infoFile} source ${infoFile}
isRaspbian=$(echo $baseimage | grep -c 'raspbian')
isArmbian=$(echo $baseimage | grep -c 'armbian')
resizeRaspbian="/usr/bin/raspi-config"
resizeArmbian="/usr/lib/armbian/armbian-resize-filesystem"
minimumSizeByte=8192000000 minimumSizeByte=8192000000
rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3) rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3)
@ -48,51 +44,57 @@ rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' '
echo "rootPartition(${rootPartition})" >> ${logFile} echo "rootPartition(${rootPartition})" >> ${logFile}
echo "rootPartitionBytes(${rootPartitionBytes})" >> ${logFile} echo "rootPartitionBytes(${rootPartitionBytes})" >> ${logFile}
#if [ ${#rootPartition} -gt 0 ]; then if [ ${#rootPartition} -gt 0 ]; then
# echo "### CHECKING ROOT PARTITION SIZE ###" >> ${logFile} echo "### CHECKING ROOT PARTITION SIZE ###" >> ${logFile}
# sudo sed -i "s/^message=.*/message='Checking Disk size'/g" ${infoFile} sudo sed -i "s/^message=.*/message='Checking Disk size'/g" ${infoFile}
# echo "Size in Bytes is: ${rootPartitionBytes} bytes on ($rootPartition)" >> ${logFile} echo "Size in Bytes is: ${rootPartitionBytes} bytes on ($rootPartition)" >> ${logFile}
# if [ $rootPartitionBytes -lt $minimumSizeByte ]; then if [ $rootPartitionBytes -lt $minimumSizeByte ]; then
# echo "Disk filesystem is smaller than ${minimumSizeByte} byte." >> ${logFile} echo "Disk filesystem is smaller than ${minimumSizeByte} byte." >> ${logFile}
# if [ ${fsexpanded} -eq 1 ]; then if [ ${fsexpanded} -eq 1 ]; then
# echo "There was already an attempt to expand the fs, but still not bigger than 8GB." >> ${logFile} echo "There was already an attempt to expand the fs, but still not bigger than 8GB." >> ${logFile}
# echo "SD card seems to small - at least a 16GB disk is needed. Display on LCD to user." >> ${logFile} echo "SD card seems to small - at least a 16GB disk is needed. Display on LCD to user." >> ${logFile}
# sudo sed -i "s/^state=.*/state=sdtoosmall/g" ${infoFile} sudo sed -i "s/^state=.*/state=sdtoosmall/g" ${infoFile}
# sudo sed -i "s/^message=.*/message='Min 16GB SD card needed'/g" ${infoFile} sudo sed -i "s/^message=.*/message='Min 16GB SD card needed'/g" ${infoFile}
# exit 1 exit 1
# else else
# echo "Try to expand SD card FS, display info and reboot." >> ${logFile} echo "Try to expand SD card FS, display info and reboot." >> ${logFile}
# sudo sed -i "s/^state=.*/state=reboot/g" ${infoFile} sudo sed -i "s/^state=.*/state=reboot/g" ${infoFile}
# sudo sed -i "s/^message=.*/message='Expanding SD Card'/g" ${infoFile} sudo sed -i "s/^message=.*/message='Expanding SD Card'/g" ${infoFile}
# sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" ${infoFile} sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" ${infoFile}
# if [ "${cpu}" == "x86_64" ]; then sleep 4
# echo "Please expand disk size." >> ${logFile} if [ "${cpu}" == "x86_64" ]; then
# # TODO: Expand disk size on x86_64 echo "Please expand disk size." >> ${logFile}
# elif [ ${isRaspbian} -gt 0 ]; then # TODO: Expand disk size on x86_64
# if [ -x ${resizeRaspbian} ]; then elif [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
# echo "RUNNING EXPAND: ${resizeRaspbian}" >> ${logFile} resizeRaspbian="/usr/bin/raspi-config"
# sudo $resizeRaspbian --expand-rootfs if [ -x ${resizeRaspbian} ]; then
# else echo "RUNNING EXPAND RASPBERRYPI: ${resizeRaspbian}" >> ${logFile}
# echo "FAIL to execute: ${resizeRaspbian}" >> ${logFile} sudo $resizeRaspbian --expand-rootfs
# fi sudo shutdown -r now
# elif [ ${isArmbian} -gt 0 ]; then exit 0
# if [ -x ${resizeArmbian} ]; then else
# echo "RUNNING EXPAND: ${resizeArmbian}" >> ${logFile} echo "FAIL to execute: ${resizeRaspbian}" >> ${logFile}
# sudo $resizeArmbian start fi
# else elif [ "${baseimage}" = "armbian" ]; then
# echo "FAIL to execute: ${resizeArmbian}" >> ${logFile} resizeArmbian="/usr/lib/armbian/armbian-resize-filesystem"
# fi if [ -x ${resizeArmbian} ]; then
# fi echo "RUNNING EXPAND ARMBIAN: ${resizeArmbian}" >> ${logFile}
# sleep 6 sudo $resizeArmbian start
# sudo shutdown -r now sudo shutdown -r now
# exit 0 exit 0
# fi else
# else echo "FAIL to execute: ${resizeArmbian}" >> ${logFile}
# echo "Size looks good. Bigger than ${minimumSizeByte} byte disk is used." >> ${logFile} fi
# fi else
#else echo "WARN on provision - Not known system expand-rootfs OS: ${baseimage}" >> ${logFile}
# echo "Disk of root partition ('$rootPartition') not detected, skipping the size check." >> ${logFile} fi
#fi fi
else
echo "Size looks good. Bigger than ${minimumSizeByte} byte disk is used." >> ${logFile}
fi
else
echo "Disk of root partition ('$rootPartition') not detected, skipping the size check." >> ${logFile}
fi
# import config values # import config values
sudo chmod 777 ${configFile} sudo chmod 777 ${configFile}

View File

@ -78,6 +78,8 @@ source ${infoFile} 2>/dev/null
echo "Resetting the InfoFile: ${infoFile}" echo "Resetting the InfoFile: ${infoFile}"
echo "state=starting" > $infoFile echo "state=starting" > $infoFile
echo "message=" >> $infoFile echo "message=" >> $infoFile
echo "baseimage=${baseimage}" >> $infoFile
echo "cpu=${cpu}" >> $infoFile
echo "network=${network}" >> $infoFile echo "network=${network}" >> $infoFile
echo "chain=${chain}" >> $infoFile echo "chain=${chain}" >> $infoFile
echo "fsexpanded=${fsexpanded}" >> $infoFile echo "fsexpanded=${fsexpanded}" >> $infoFile
@ -88,46 +90,6 @@ if [ "${setupStep}" != "100" ]; then
fi fi
sudo chmod 777 ${infoFile} sudo chmod 777 ${infoFile}
################################
# IDENTIFY CPU ARCHITECTURE
################################
cpu="?"
isARM=$(uname -m | grep -c 'arm')
isAARCH64=$(uname -m | grep -c 'aarch64')
isX86_64=$(uname -m | grep -c 'x86_64')
if [ ${isARM} -gt 0 ]; then
cpu="arm"
elif [ ${isAARCH64} -gt 0 ]; then
cpu="aarch64"
elif [ ${isX86_64} -gt 0 ]; then
cpu="x86_64"
fi
echo "cpu=${cpu}" >> $infoFile
################################
# IDENTIFY BASEIMAGE
################################
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
# resetting start count files # resetting start count files
echo "SYSTEMD RESTART LOG: blockchain (bitcoind/litecoind)" > /home/admin/systemd.blockchain.log echo "SYSTEMD RESTART LOG: blockchain (bitcoind/litecoind)" > /home/admin/systemd.blockchain.log
echo "SYSTEMD RESTART LOG: lightning (LND)" > /home/admin/systemd.lightning.log echo "SYSTEMD RESTART LOG: lightning (LND)" > /home/admin/systemd.lightning.log
@ -227,10 +189,9 @@ if [ ${afterSetupScriptExists} -eq 1 ]; then
sudo rm /home/admin/setup.sh sudo rm /home/admin/setup.sh
# reboot again # reboot again
echo "DONE wait 10 secs ... one more reboot needed ... " >> /home/admin/raspiblitz.recover.log echo "DONE wait 10 secs ... one more reboot needed ... " >> /home/admin/raspiblitz.recover.log
echo "DONE wait 10 secs ... one more reboot needed ... "
sleep 10
sudo shutdown -r now sudo shutdown -r now
sleep 100 sleep 100
exit 0
fi fi
################################ ################################
@ -246,8 +207,6 @@ if [ ${forceHDMIoutput} -eq 1 ]; then
sudo rm /boot/hdmi* sudo rm /boot/hdmi*
# switch to HDMI what will trigger reboot # switch to HDMI what will trigger reboot
echo "Switching HDMI ON ... (reboot) " >> /home/admin/raspiblitz.recover.log echo "Switching HDMI ON ... (reboot) " >> /home/admin/raspiblitz.recover.log
echo "Switching HDMI ON ... (reboot) "
sleep 10
sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on
exit 0 exit 0
fi fi
@ -279,8 +238,6 @@ if [ ${sshReset} -eq 1 ]; then
sudo rm /mnt/hdd/ssh/ssh_host* sudo rm /mnt/hdd/ssh/ssh_host*
sudo ssh-keygen -A sudo ssh-keygen -A
echo "SSH SERVER CERTS RESET ... (reboot) " >> /home/admin/raspiblitz.recover.log echo "SSH SERVER CERTS RESET ... (reboot) " >> /home/admin/raspiblitz.recover.log
echo "SSH SERVER CERTS RESET ... (reboot) "
sleep 10
sudo /home/admin/XXshutdown.sh reboot sudo /home/admin/XXshutdown.sh reboot
exit 0 exit 0
fi fi
@ -316,26 +273,28 @@ echo "isMounted: $isMounted" >> $logFile
# check if UASP is already deactivated (on RaspiOS) # check if UASP is already deactivated (on RaspiOS)
# https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/ # https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
# cmdlineExists=$(sudo ls /boot/cmdline.txt 2>/dev/null | grep -c "cmdline.txt") cmdlineExists=$(sudo ls /boot/cmdline.txt 2>/dev/null | grep -c "cmdline.txt")
# if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ]; then if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ] && [ ${hddAdapterUSAP} -eq 0 ]; then
# echo "Checking for UASP deactivation ..." >> $logFile echo "Checking for UASP deactivation ..." >> $logFile
# usbQuirkActive=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=") usbQuirkActive=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=")
# # check if its maybe other device # check if its maybe other device
# usbQuirkDone=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u") usbQuirkDone=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u")
# if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then
# # remove old usb-storage.quirks # remove old usb-storage.quirks
# sudo sed -i "s/usb-storage.quirks=[^ ]* //g" /boot/cmdline.txt sudo sed -i "s/usb-storage.quirks=[^ ]* //g" /boot/cmdline.txt
# fi fi
# if [ ${usbQuirkDone} -eq 0 ]; then if [ ${usbQuirkDone} -eq 0 ]; then
# # add new usb-storage.quirks # add new usb-storage.quirks
# sudo sed -i "1s/^/usb-storage.quirks=${hddAdapterUSB}:u /" /boot/cmdline.txt sudo sed -i "1s/^/usb-storage.quirks=${hddAdapterUSB}:u /" /boot/cmdline.txt
# sudo cat /boot/cmdline.txt sudo cat /boot/cmdline.txt
# # go into reboot to activate new setting # go into reboot to activate new setting
# echo "DONE deactivating UASP for ${hddAdapterUSB} ... one more reboot needed ... " echo "DONE deactivating UASP for ${hddAdapterUSB} ... one more reboot needed ... "
# #sudo shutdown -r now sudo shutdown -r now
# #sleep 100 sleep 100
# fi fi
#fi else
echo "Skipping UASP deactivation ... cmdlineExists(${cmdlineExists}) hddAdapterUSB(${hddAdapterUSB}) hddAdapterUSAP(${hddAdapterUSAP})" >> $logFile
fi
# check if the HDD is auto-mounted ( auto-mounted = setup-done) # check if the HDD is auto-mounted ( auto-mounted = setup-done)
if [ ${isMounted} -eq 0 ]; then if [ ${isMounted} -eq 0 ]; then
@ -433,8 +392,6 @@ if [ ${isMounted} -eq 0 ]; then
cp $logFile /home/admin/raspiblitz.recover.log cp $logFile /home/admin/raspiblitz.recover.log
sync sync
echo "SSH SERVER CERTS RESET ... (reboot) " >> /home/admin/raspiblitz.recover.log echo "SSH SERVER CERTS RESET ... (reboot) " >> /home/admin/raspiblitz.recover.log
echo "SSH SERVER CERTS RESET ... (reboot) "
sleep 10
sudo shutdown -r -F -t 60 sudo shutdown -r -F -t 60
exit 0 exit 0
else else
@ -644,7 +601,7 @@ fi
# STRESSTEST RASPBERRY PI # STRESSTEST RASPBERRY PI
################################ ################################
if [ "${baseImage}" = "raspbian" ] ; then if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
# generate stresstest report on every startup (in case hardware has changed) # generate stresstest report on every startup (in case hardware has changed)
sed -i "s/^state=.*/state=stresstest/g" ${infoFile} sed -i "s/^state=.*/state=stresstest/g" ${infoFile}
sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile} sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile}

File diff suppressed because it is too large Load Diff

View File

@ -312,10 +312,30 @@ if [ "$1" = "status" ]; then
fi fi
# determine UAS string --> https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/ # HDD Adpater UASP support --> https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
if [ ${#hdd} -gt 0 ]; then if [ ${#hdd} -gt 0 ]; then
# determine USB HDD adapter model ID
hddAdapter=$(lsusb | grep "SATA" | head -1 | cut -d " " -f6) hddAdapter=$(lsusb | grep "SATA" | head -1 | cut -d " " -f6)
if [ "${hddAdapter}" == "" ]; then
hddAdapter=$(lsusb | grep "GC Protronics" | head -1 | cut -d " " -f6)
fi
if [ "${hddAdapter}" == "" ]; then
hddAdapter=$(lsusb | grep "ASMedia Technology" | head -1 | cut -d " " -f6)
fi
echo "hddAdapterUSB='${hddAdapter}'" echo "hddAdapterUSB='${hddAdapter}'"
# check if HDD ADAPTER is on UASP WHITELIST (tested devices)
hddAdapterUSAP=0
if [ "${hddAdapter}" == "174c:55aa" ]; then
# UGREEN 2.5" External USB 3.0 Hard Disk Case with UASP support
hddAdapterUSAP=1
fi
if [ "${hddAdapter}" == "0825:0001" ] || [ "${hddAdapter}" == "174c:0825" ]; then
# SupTronics 2.5" SATA HDD Shield X825 v1.5
hddAdapterUSAP=1
fi
echo "hddAdapterUSAP='${hddAdapterUSAP}'"
fi fi
echo echo