summarylogtreecommitdiffstats
path: root/zoneminder.install
diff options
context:
space:
mode:
authorAlexandros Michalopoulos2018-12-09 19:20:02 +0200
committerAlexandros Michalopoulos2018-12-09 19:20:33 +0200
commit12ff9400e65e40d3bbb2cf20a6296b2a3b6414e8 (patch)
tree8a44275028ad0f561b7edc03ebd152006949c9ae /zoneminder.install
parent821b2eff44c8378ab3092657fc1abf8dac8321f3 (diff)
downloadaur-12ff9400e65e40d3bbb2cf20a6296b2a3b6414e8.tar.gz
v=1.32.3,r=1
Diffstat (limited to 'zoneminder.install')
-rw-r--r--zoneminder.install79
1 files changed, 52 insertions, 27 deletions
diff --git a/zoneminder.install b/zoneminder.install
index 0f294577ea0..d3537908e70 100644
--- a/zoneminder.install
+++ b/zoneminder.install
@@ -1,8 +1,7 @@
post_install() {
echo
- systemctl daemon-reload
-
+ systemctl daemon-reload
### Nginx & Apache ###
@@ -71,7 +70,6 @@ post_install() {
echo
fi
-
### fcgiwrap ###
if [[ "$(pacman -Qs fcgiwrap)" = *"local/fcgiwrap"* ]]
@@ -92,7 +90,6 @@ post_install() {
}
fi
-
### PHP-FPM ###
# Set local timezone in /etc/php/conf.d/zoneminder.ini
@@ -104,7 +101,6 @@ post_install() {
systemctl start php-fpm
fi
-
### MariaDB ###
# If MariaDB is installed
@@ -135,22 +131,21 @@ post_install() {
echo
echo "* Enter the password one more time..."
echo
- mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ mysql -uroot -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
echo
else
# If a database root password is not set
mysql -uroot < /usr/share/zoneminder/db/zm_create.sql
- mysql -uroot -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ mysql -uroot -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
fi
fi
fi
-
### ZoneMinder ###
systemctl is-active --quiet zoneminder && systemctl stop zoneminder
systemd-tmpfiles --create
- systemctl start zoneminder &&
+ systemctl start --quiet zoneminder &&
{
echo "---------------"
echo
@@ -158,35 +153,65 @@ post_install() {
if [[ "$(systemctl is-active nginx)" = active ]] || [[ "$(systemctl is-active httpd)" = active ]]
then
echo "ZoneMinder is listening at http://localhost:8095"
+ echo
else
echo "WARNING: ZoneMinder is running, but no web server has been configured."
+ echo
fi
echo
}
}
post_upgrade() {
- post_install
-
- echo "---------------"
- echo
- echo "The ZoneMinder updater will now run."
+ # Parse zm.conf and any custom configuration files
+ . /etc/zoneminder/zm.conf
+ for CONF in /etc/zoneminder/conf.d/*.conf; do
+ . $CONF
+ done
+
+ # Check if we're running a local database server
+ if [ "$ZM_DB_HOST" = "localhost" ]; then
+ systemctl daemon-reload
- # Make sure ZoneMinder is *not* running before we attempt to use the updater
- systemctl is-active --quiet zoneminder && systemctl stop zoneminder
-
- # Make sure MariaDB *is* running before we attempt to use the updater
- # NOTE: We probably don't want this in a Multi Server setup because MariaDB will not be running locally,
- # but since it will simply generate a harmless error and the updater will still run, for now I'm leaving it as is
- systemctl is-active --quiet mariadb || systemctl start mariadb
-
- # Run the updater
- /usr/bin/zmupdate.pl
+ # Make sure MariaDB is running before we attempt to use the updater
+ systemctl is-active --quiet mariadb || systemctl start mariadb
+
+ # Make sure ZoneMinder is *not* running before we attempt to use the updater
+ systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+
+ echo
+ echo "---------------"
+
+ # Temporary solution to apply new privileges on preexisting user & database
+ # Check for database root password
+ if [[ "$(mysql -uroot -e "select * from mysql.user;" 2>&1)" = *"Access denied"* ]]
+ then
+ # If a database root password is set
+ echo
+ echo "* Secure MariaDB installation found, please enter the database root password."
+ echo
+ mysql -uroot -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ else
+ # If a database root password is not set
+ mysql -uroot -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ fi
+
+ # Run the updater
+ /usr/bin/zmupdate.pl --nointeractive
+ /usr/bin/zmupdate.pl --nointeractive --freshen > /dev/null 2>&1
+
+ # Update PTZ control presets
+ /usr/bin/zmcamtool.pl --import > /dev/null 2>&1
- systemctl start zoneminder
+ systemctl start zoneminder
+ else
+ echo
+ echo "---------------"
+ echo
+ echo "Multiserver setup detected, database update skipped."
+ fi
- echo "Update complete."
- echo
+ post_install
}
post_remove() {