diff --git a/Installer.sh b/Installer.sh index 719c07d..3fc4cab 100644 --- a/Installer.sh +++ b/Installer.sh @@ -86,6 +86,15 @@ if [[ $AGREE != "yes" ]]; then INSTALL=no fi fi + +if (whiptail --title "Pi Automation" --yesno "Is this device configured with a static IP?." 8 78); then + echo "" + else + whiptail --title "Pi Automation" --msgbox "Configure a static IP first!" 8 78 + clear + exit +fi + if [[ $INSTALL == no ]]; then whiptail --title "Pi Automation" --msgbox "Installation canceled!" 8 78 clear @@ -131,6 +140,15 @@ if [[ $SKIPoptions != "yes" ]]; then "Monitor-Service" "Autologin the Pi user to show system and service statuses. (usefull with TFT)" OFF 3>&1 1>&2 2>&3) fi +if [[ $OPTIONS == *"Domoticz"* ]]; then + if (whiptail --title "Domoticz Options" --yesno "Use a Smart-Pinger that tracks your phones presence?\nThis is done by searching for your phones Wifi and Bluetooth status." 8 78); then + SMARTPING=yes + whiptail --title "Important" --msgbox "Make sure to set up your mobile device to use a static ip!" 8 78 + else + SMARTPING=no + fi +fi + if [[ $SKIPhomer != "yes" ]]; then if [[ $OPTIONS == *"Homer"* ]]; then ISP=$(whiptail --title "Configure Options" --radiolist \ @@ -206,28 +224,34 @@ sleep 3 dphys-swapfile swapoff ; dphys-swapfile uninstall ; update-rc.d dphys-swapfile remove systemctl disable ModemManager -echo "python3-dev python3-pip" >> /tmp/install.list +echo "python3-dev python3-pip unzip" >> /tmp/install.list if [[ $OPTIONS == *"Domoticz"* ]]; then - echo "apt-utils git unzip 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 + echo "fping" >> /tmp/install.list + fi fi + if [[ $OPTIONS == *"Node-RED"* ]]; then echo "build-essential git mosquitto mosquitto-clients" >> /tmp/install.list fi if [[ $OPTIONS == *"Zigbee2MQTT"* ]]; then echo "git make g++ gcc mosquitto mosquitto-clients" >> /tmp/install.list if [[ $OPTIONS != *"Node-RED"* ]]; then - echo "ca-certificates gnupg nodejs" >> /tmp/install.list + echo "ca-certificates gnupg curl" >> /tmp/install.list mkdir -p /etc/apt/keyrings - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg fi fi + if [[ $OPTIONS == *"Unattended-Upgrades"* ]]; then echo "unattended-upgrades apt-listchanges" >> /tmp/install.list fi + if [[ $OPTIONS == *"Homer"* ]]; then - echo "nginx unzip" >> /tmp/install.list + echo "nginx" >> /tmp/install.list fi + ##-----------## # Updater # ##-----------## @@ -243,6 +267,14 @@ echo "ufw" >> /tmp/install.list echo "gcc g++ gawk autoconf automake python3-cmarkgfm libssl-dev attr libxxhash-dev libattr1-dev liblz4-dev libzstd-dev acl libacl1-dev" >> /tmp/install.list xargs < /tmp/install.list xargs $PKGI +#Run updater again for installation NodeJS since now the required dependencies are installed on the system. +if [[ $OPTIONS != *"Node-RED"* ]]; then + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list + echo "nodejs" > /tmp/install.list + $PKGUD + xargs < /tmp/install.list xargs $PKGI +fi ##-------------## # Installer # @@ -312,6 +344,12 @@ if [[ $OPTIONS == *"Domoticz"* ]]; then chmod +x /etc/init.d/domoticz.sh update-rc.d domoticz.sh defaults systemctl start domoticz + if [[ $SMARTPING == "yes" ]]; then + mkdir -p /var/log/pid/ + mkdir -p /var/pinger + wget $GIT/$BRANCH/Domoticz/SmartPinger.sh -O /opt/pinger/Smartping-NAME.sh + wget $GIT/$BRANCH/Domoticz/SmartPinger.service -O /etc/systemd/system/Smartping-NAME.service + fi fi @@ -424,6 +462,23 @@ if [[ $OPTIONS == *"Homer"* ]]; then fi fi + +##-------------------## +# Personalization # +##-------------------## + +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 + fi + if [[ $OPTIONS == *"Homer"* ]]; then + wget $GIT/$BRANCH/Homer/Customisation/light.jpeg -O /var/www/html/assets/wallpaper-light.jpeg + wget $GIT/$BRANCH/Homer/Customisation/dark.jpeg -O /var/www/html/assets/wallpaper.jpeg + fi +fi + + ##-----------------## # Optimizing Pi # ##-----------------## @@ -495,7 +550,13 @@ TERM=ansi whiptail --title "Pi Automation" --infobox "Finishing." 8 78 sleep 3 wget $GIT/$BRANCH/Updater.sh -O /opt/updater.sh -wget $GIT/$BRANCH/MOTD/greetings.sh -O /etc/profile.d/greeting.sh + +if [[ $SMARTPING == "no" ]]; then + wget $GIT/$BRANCH/MOTD/greetings.sh -O /etc/profile.d/greeting.sh + else + wget $GIT/$BRANCH/MOTD/greetings-pinger.sh -O /etc/profile.d/greeting.sh +fi + sed -i -e "s/%name%/$NAME/g" /etc/profile.d/greeting.sh mkdir -p /opt/backups/timestamps/ @@ -529,4 +590,4 @@ then else whiptail --title "Done!" --msgbox "The Raspberry Pi will reboot. Press OK to continue." 8 78 reboot -fi +fi \ No newline at end of file