From bf955b86f97cad734e5fc1d16eb5946cf86eebd7 Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Wed, 13 Sep 2023 03:22:53 +0200 Subject: [PATCH] Update 'Installer.sh' Set Test all but one variables to =no. Added test variable that times the installer in order to measure performance gains. Added change to Governer when installer starts, to speed up a little Governer is set to Performce for the duration of the install. Changed NodeRed installation behaviour to remove Clear in their script for debugging purposes. Removed Domoticz dialog to choose the correct option (update or reconfigure), this is deprecated since Domoticz now installs unattended. Added custom backgrounds for all other Domoticz themes that support backgrounds when the user Jarno is detected. Deleted libx11 from the deinstallation list, this was causing conflicts with Nginx when trying to Remove or Autoremove. --- Installer.sh | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/Installer.sh b/Installer.sh index 3fc4cab..cbc0f2d 100644 --- a/Installer.sh +++ b/Installer.sh @@ -4,10 +4,11 @@ # Test Vars # ##-------------## -AGREE=yes -SKIPinfo=yes -SKIPoptions=yes -SKIPhomer=yes +AGREE=no +SKIPinfo=no +SKIPoptions=no +SKIPhomer=no +Timer=yes if [[ $SKIPoptions == "yes" ]]; then OPTIONS='"Domoticz" "Zigbee2MQTT" "Unattended-Upgrades" "Monitor-Service" "Homer"' @@ -164,6 +165,13 @@ fi # Pre-Configuring # ##-------------------## +if [[ $Timer == "yes" ]]; then + timewhenstarted=$(date +"%T") +fi + +#Set Governor to Performance so the installer runs a little faster. +echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + TERM=ansi whiptail --title "Pi Automation" --infobox "Preparing the Raspberry Pi." 8 78 sleep 3 @@ -225,6 +233,7 @@ dphys-swapfile swapoff ; dphys-swapfile uninstall ; update-rc.d dphys-swapfile r systemctl disable ModemManager echo "python3-dev python3-pip unzip" >> /tmp/install.list + if [[ $OPTIONS == *"Domoticz"* ]]; then echo "apt-utils git cron libudev-dev libsqlite3-0 libcurl4 libusb-0.1-4" >> /tmp/install.list if [[ $SMARTPING == "yes" ]]; then @@ -298,7 +307,11 @@ cd ~ if [[ $OPTIONS == *"Node-RED"* ]]; then TERM=ansi whiptail --title "Pi Automation" --infobox "Installing Node-RED." 8 78 sleep 3 - bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --confirm-root --confirm-install --skip-pi --node18 --no-init + #Instead of downloading and executing immediately, first download and don't execute yet. + #Remove the clear command to prevent screen from being wiped and not being able to backtrack the terminal for debugging. + wget https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered -O /tmp/nodered.sh + sed -i '/clear/d' /tmp/nodered.sh + bash /tmp/nodered.sh --confirm-root --confirm-install --skip-pi --node18 --no-init systemctl enable nodered cd /root/.node-red/ npm install @node-red-contrib-themes/midnight-red @@ -335,11 +348,11 @@ if [[ $OPTIONS == *"Homer"* ]]; then unzip /tmp/dashboard.zip -d /var/www/html/ fi if [[ $OPTIONS == *"Domoticz"* ]]; then - TERM=ansi whiptail --title "Pi Automation" --msgbox "In the next dialog tell Domoticz to update.\nDo NOT select reconfigure!\n\nPress OK to continue." 10 78 + TERM=ansi whiptail --title "Pi Automation" --infobox "Installing Domoticz." 8 78 mkdir -p /etc/domoticz/ wget $GIT/$BRANCH/Domoticz/DomoSetup.conf -O /etc/domoticz/setupVars.conf mkdir -p /opt/domoticz/ - bash -c "$(curl -sSfL https://install.domoticz.com)" + bash -c "$(curl -sSfL https://install.domoticz.com) --unattended" wget $GIT/$BRANCH/Domoticz/DomoService.conf -O /etc/init.d/domoticz.sh chmod +x /etc/init.d/domoticz.sh update-rc.d domoticz.sh defaults @@ -471,6 +484,9 @@ if [[ $NAME == "Jarno" ]]; then if [[ $OPTIONS == *"Domoticz"* ]]; then wget $GIT/$BRANCH/Domoticz/Customisation/custom.css -O /opt/domoticz/www/styles/dark-th3me/custom.css wget $GIT/$BRANCH/Domoticz/Customisation/bosduif.jpg -O /opt/domoticz/www/styles/dark-th3me/images/domoticz.jpg + wget $GIT/$BRANCH/Domoticz/Customisation/bosduif.jpg -O /opt/domoticz/www/styles/element-dark/images/imgbg.jpg + wget $GIT/$BRANCH/Domoticz/Customisation/bosduif.jpg -O /opt/domoticz/www/styles/element-light/images/imgbg.jpg + wget $GIT/$BRANCH/Domoticz/Customisation/bosduif.jpg -O /opt/domoticz/www/styles/elemental/images/imgbg.jpg fi if [[ $OPTIONS == *"Homer"* ]]; then wget $GIT/$BRANCH/Homer/Customisation/light.jpeg -O /var/www/html/assets/wallpaper-light.jpeg @@ -539,7 +555,7 @@ sed -i 's/\"//g' /etc/installedmodules TERM=ansi whiptail --title "Pi Automation" --infobox "Cleaning up unnecessary packages." 8 78 sleep 3 -$PKRM dphys-swapfile* manpages* p7zip* vim* pigz* strace* rng-tools* triggerhappy* libcamera* libx11* libboost* mkvtoolnix* libmagic* raspi-gpio mailcap bzip2 libxext6 dc ntfs-3g ncdu ed python3-numpy python3-spidev python3-rpi.gpio python3-cmarkgfm python3-toml python3-colorzero python3-chardet gcc g++ gawk autoconf automake libssl-dev attr libxxhash-dev libattr1-dev liblz4-dev libzstd-dev acl libacl1-dev +$PKRM dphys-swapfile* manpages* p7zip* vim* pigz* strace* rng-tools* triggerhappy* libcamera* libboost* mkvtoolnix* libmagic* raspi-gpio mailcap bzip2 libxext6 dc ntfs-3g ncdu ed python3-numpy python3-spidev python3-rpi.gpio python3-cmarkgfm python3-toml python3-colorzero python3-chardet gcc g++ gawk autoconf automake libssl-dev attr libxxhash-dev libattr1-dev liblz4-dev libzstd-dev acl libacl1-dev $PKARM ##-------------## @@ -583,6 +599,13 @@ if [[ $OPTIONS == *"Homer"* ]]; then fi fi +if [[ $Timer == "yes" ]]; then + timewhendone=$(date +"%T") + echo "Setup started at: $timewhenstarted" + echo "Setup finished at: $timewhendone" + read -p "Press enter to continue" +fi + if grep -q "ssid=" /etc/wpa_supplicant/wpa_supplicant.conf then whiptail --title "Done!" --msgbox "The Raspberry Pi will shutdown,\nplease remove the LAN cable before starting up again.\n\nPress OK to continue." 10 78