From 3fd4a5007857258f6587f8f9d3c9c6fb035934ab Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Sun, 17 Sep 2023 22:33:28 -0400
Subject: [PATCH] Update pialert-install.sh

- added a new "update" command that allows you to execute updates for Pi.Alert.
- tweaks
---
 install/pialert-install.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/install/pialert-install.sh b/install/pialert-install.sh
index f0e3f0d6..34b57319 100644
--- a/install/pialert-install.sh
+++ b/install/pialert-install.sh
@@ -53,8 +53,8 @@ $STD pip3 install fritzconnection
 $STD pip3 install cryptography
 msg_ok "Installed Python Dependencies"
 
-msg_info "Installing Pi.Alert (Patience)"
-git clone -q https://github.com/leiweibau/Pi.Alert.git /opt/pialert
+msg_info "Installing Pi.Alert"
+curl -sL https://github.com/leiweibau/Pi.Alert/raw/main/tar/pialert_latest.tar | tar xvf - -C /opt >/dev/null 2>&1
 mkdir -p /opt/pialert/front/reports
 rm -rf /var/www/html/index.html
 mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old
@@ -69,9 +69,13 @@ dest_dir="/opt/pialert/front/php/server"
 for file in pialert.vendors.log pialert.IP.log pialert.1.log pialert.cleanup.log pialert.webservices.log; do
     ln -s "$src_dir/$file" "$dest_dir/$file"
 done
+git config --global --add safe.directory /opt/pialert
 sed -i 's#PIALERT_PATH\s*=\s*'\''/home/pi/pialert'\''#PIALERT_PATH           = '\''/opt/pialert'\''#' /opt/pialert/config/pialert.conf
 sed -i 's/~/\/opt/g' /opt/pialert/install/pialert.cron
 (crontab -l 2>/dev/null; cat /opt/pialert/install/pialert.cron) | crontab -
+cp -R /opt/pialert/install/pialert_update.sh /usr/bin/update
+sed -i 's/~/\/opt/g' /usr/bin/update
+chmod +x /usr/bin/update
 echo "python3 /opt/pialert/back/pialert.py 1" >/usr/bin/scan
 chmod +x /usr/bin/scan
 echo "/opt/pialert/back/pialert-cli set_permissions --lxc" >/usr/bin/permissions