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.
This commit is contained in:
b.waal 2023-09-13 03:22:53 +02:00
parent 28df236f35
commit bf955b86f9

View File

@ -4,10 +4,11 @@
# Test Vars # # Test Vars #
##-------------## ##-------------##
AGREE=yes AGREE=no
SKIPinfo=yes SKIPinfo=no
SKIPoptions=yes SKIPoptions=no
SKIPhomer=yes SKIPhomer=no
Timer=yes
if [[ $SKIPoptions == "yes" ]]; then if [[ $SKIPoptions == "yes" ]]; then
OPTIONS='"Domoticz" "Zigbee2MQTT" "Unattended-Upgrades" "Monitor-Service" "Homer"' OPTIONS='"Domoticz" "Zigbee2MQTT" "Unattended-Upgrades" "Monitor-Service" "Homer"'
@ -164,6 +165,13 @@ fi
# Pre-Configuring # # 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 TERM=ansi whiptail --title "Pi Automation" --infobox "Preparing the Raspberry Pi." 8 78
sleep 3 sleep 3
@ -225,6 +233,7 @@ dphys-swapfile swapoff ; dphys-swapfile uninstall ; update-rc.d dphys-swapfile r
systemctl disable ModemManager systemctl disable ModemManager
echo "python3-dev python3-pip unzip" >> /tmp/install.list echo "python3-dev python3-pip unzip" >> /tmp/install.list
if [[ $OPTIONS == *"Domoticz"* ]]; then if [[ $OPTIONS == *"Domoticz"* ]]; then
echo "apt-utils git cron libudev-dev libsqlite3-0 libcurl4 libusb-0.1-4" >> /tmp/install.list echo "apt-utils git cron libudev-dev libsqlite3-0 libcurl4 libusb-0.1-4" >> /tmp/install.list
if [[ $SMARTPING == "yes" ]]; then if [[ $SMARTPING == "yes" ]]; then
@ -298,7 +307,11 @@ cd ~
if [[ $OPTIONS == *"Node-RED"* ]]; then if [[ $OPTIONS == *"Node-RED"* ]]; then
TERM=ansi whiptail --title "Pi Automation" --infobox "Installing Node-RED." 8 78 TERM=ansi whiptail --title "Pi Automation" --infobox "Installing Node-RED." 8 78
sleep 3 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 systemctl enable nodered
cd /root/.node-red/ cd /root/.node-red/
npm install @node-red-contrib-themes/midnight-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/ unzip /tmp/dashboard.zip -d /var/www/html/
fi fi
if [[ $OPTIONS == *"Domoticz"* ]]; then 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/ mkdir -p /etc/domoticz/
wget $GIT/$BRANCH/Domoticz/DomoSetup.conf -O /etc/domoticz/setupVars.conf wget $GIT/$BRANCH/Domoticz/DomoSetup.conf -O /etc/domoticz/setupVars.conf
mkdir -p /opt/domoticz/ 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 wget $GIT/$BRANCH/Domoticz/DomoService.conf -O /etc/init.d/domoticz.sh
chmod +x /etc/init.d/domoticz.sh chmod +x /etc/init.d/domoticz.sh
update-rc.d domoticz.sh defaults update-rc.d domoticz.sh defaults
@ -471,6 +484,9 @@ if [[ $NAME == "Jarno" ]]; then
if [[ $OPTIONS == *"Domoticz"* ]]; 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/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/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 fi
if [[ $OPTIONS == *"Homer"* ]]; then if [[ $OPTIONS == *"Homer"* ]]; then
wget $GIT/$BRANCH/Homer/Customisation/light.jpeg -O /var/www/html/assets/wallpaper-light.jpeg 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 TERM=ansi whiptail --title "Pi Automation" --infobox "Cleaning up unnecessary packages." 8 78
sleep 3 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 $PKARM
##-------------## ##-------------##
@ -583,6 +599,13 @@ if [[ $OPTIONS == *"Homer"* ]]; then
fi fi
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 if grep -q "ssid=" /etc/wpa_supplicant/wpa_supplicant.conf
then 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 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