Update pialert_install.sh

This commit is contained in:
pucherot
2021-01-26 16:16:02 +01:00
committed by GitHub
parent 42b6e99ada
commit a4eb028801

View File

@@ -8,8 +8,6 @@
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3 # Puche 2021 pi.alert.application@gmail.com GNU GPLv3
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# stop on errors
set -e
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Variables # Variables
@@ -63,20 +61,9 @@ main() {
log "Logfile: $LOG" log "Logfile: $LOG"
check_pialert_home check_pialert_home
print_msg "Use: - http://pi.alert/"
ask_yesno "This script will install Pi.Alert in this system using this path:\n$PIALERT_HOME" \
"Do you want to continue ?"
if ! $ANSWER ; then
exit 1
fi
ask_config ask_config
msgbox "Configuration finished. To updete the configuration, edit file:" \ set -e
"$PIALERT_HOME/config/pialert.conf"
msgbox "" "The installation will start now"
install_pihole install_pihole
activate_DHCP activate_DHCP
@@ -99,7 +86,13 @@ main() {
# Ask config questions # Ask config questions
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
ask_config() { ask_config() {
set +e # Ask installation
ask_yesno "This script will install Pi.Alert in this system using this path:\n$PIALERT_HOME" \
"Do you want to continue ?"
if ! $ANSWER ; then
exit 1
fi
# Ask Pi-hole Installation # Ask Pi-hole Installation
PIHOLE_ACTIVE=false PIHOLE_ACTIVE=false
if [ -e /usr/local/bin/pihole ] || [ -e /etc/pihole ]; then if [ -e /usr/local/bin/pihole ] || [ -e /etc/pihole ]; then
@@ -220,7 +213,11 @@ ask_config() {
DDNS_UPDATE_URL=$ANSWER DDNS_UPDATE_URL=$ANSWER
fi fi
set -e # Final config message
msgbox "Configuration finished. To updete the configuration, edit file:" \
"$PIALERT_HOME/config/pialert.conf"
msgbox "" "The installation will start now"
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@@ -324,7 +321,7 @@ install_lighttpd() {
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Install arp-scan # Install arp-scan & dnsutils
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
install_arpscan() { install_arpscan() {
print_header "arp-scan & dnsutils" print_header "arp-scan & dnsutils"
@@ -703,13 +700,13 @@ ask_input() {
} }
ask_cancel() { ask_cancel() {
LINE1="Do you want to cancel the installation process" LINE0="Do you want to cancel the installation process"
LINE1=$(printf "\n\n%*s" $(((${#LINE1}+$COLS-5)/2)) "$LINE1") LINE0=$(printf "\n\n%*s" $(((${#LINE0}+$COLS-5)/2)) "$LINE0")
if [ "$BUTTON" = "1" ] && [ "$1" = "CANCEL" ] ; then BUTTON="255"; fi if [ "$BUTTON" = "1" ] && [ "$1" = "CANCEL" ] ; then BUTTON="255"; fi
if [ "$BUTTON" = "255" ] ; then if [ "$BUTTON" = "255" ] ; then
whiptail --title "Pi.Alert Installation" --yesno --defaultno "$LINE1" \ whiptail --title "Pi.Alert Installation" --yesno --defaultno "$LINE0" \
$ROWS $COLS $ROWS $COLS
if [ "$?" = "0" ] ; then if [ "$?" = "0" ] ; then
@@ -767,7 +764,7 @@ process_error() {
log "Use 'cat $LOG' to view installation log" log "Use 'cat $LOG' to view installation log"
log "" log ""
msgbox "****** ERROR INSTALLING Pi.ALERT ******" "$1" # msgbox "****** ERROR INSTALLING Pi.ALERT ******" "$1"
exit 1 exit 1
} }