summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/zoneminder.install
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/zoneminder/zoneminder.install')
-rw-r--r--pcr/zoneminder/zoneminder.install69
1 files changed, 43 insertions, 26 deletions
diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install
index 899e2a5d1..66109d5fa 100644
--- a/pcr/zoneminder/zoneminder.install
+++ b/pcr/zoneminder/zoneminder.install
@@ -1,3 +1,4 @@
+#!/usr/bin/bash
pre_install() {
set -e
abort=false
@@ -27,20 +28,20 @@ EOF
post_install() {
if [[ -d /var/log/zoneminder ]]; then
- chmod 0755 /var/log/zoneminder
- chown http.http /var/log/zoneminder
+ chmod -v 0755 /var/log/zoneminder
+ chown -v http.http /var/log/zoneminder
else
- mkdir -m 0755 /var/log/zoneminder
- chown http.http /var/log/zoneminder
+ mkdir -vm 0755 /var/log/zoneminder
+ chown -v http.http /var/log/zoneminder
fi
if [[ -d /tmp/zoneminder ]]; then
- chmod 0700 /tmp/zoneminder
- chown http.http /tmp/zoneminder
+ chmod -v 0700 /tmp/zoneminder
+ chown -v http.http /tmp/zoneminder
else
- mkdir -m 0700 /tmp/zoneminder
- chown http.http /tmp/zoneminder
+ mkdir -vm 0700 /tmp/zoneminder
+ chown -v http.http /tmp/zoneminder
fi
- sed -i -e '
+ sed -i '
/^;extension=mysql.so/ s/^;//;
/^#extension=mysql.so/ s/^#//;
/^;extension=mysqli.so/ s/^;//;
@@ -69,8 +70,11 @@ post_install() {
/^open_basedir/ s/:\/srv\/http\/zoneminder//;
/^open_basedir/ s/:\/srv\/http\/zoneminder\///;
/^open_basedir/ s/$/:\/srv\/http\/zoneminder/;
- ' /etc/php/php.ini || read
- sed -i -e '
+ /^open_basedir/ s/:\/var\/cache\/zoneminder//;
+ /^open_basedir/ s/:\/var\/cache\/zoneminder\///;
+ /^open_basedir/ s/$/:\/var\/cache\/zoneminder/;
+ ' /etc/php/php.ini
+ sed -i '
/^LoadModule php5_module modules\/libphp5.so/d;
/^LoadModule rewrite_module modules\/mod_rewrite.so/ s/$/\nLoadModule php5_module modules\/libphp5.so/;
/^# PHP 5/d;
@@ -78,11 +82,12 @@ post_install() {
/^Include \/etc\/httpd\/conf\/extra\/php5_module.conf/d;
/^Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d;
/^Include conf\/extra\/httpd-default.conf/ s/$/\n\n# PHP 5\n\Include \/etc\/httpd\/conf\/extra\/php5_module.conf\n\n# ZoneMinder\nInclude \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/;
- ' /etc/httpd/conf/httpd.conf || read
+ ' /etc/httpd/conf/httpd.conf
+ gpasswd -a http video
cat << EOF
Note for mysql:
==> To run Zoneminder, you must install the database running mysql service (as root):
-==> "rc.d start mysqld" (in initscripts) or "systemctl start mysqld.service" (in systemd)
+==> "systemctl start mysqld.service"
==> and add Zoneminder database typing (with passsword):
==> "mysqladmin --defaults-file=/etc/mysql/my.cnf -p -f reload"
==> "cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/my.cnf -p"
@@ -92,6 +97,11 @@ Note for mysql:
==> "cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/my.cnf"
==> "echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/my.cnf mysql"
+Note for sysctl:
+==> You must uncomment that line in /etc/sysctl.d/sysctl-zoneminder.conf:
+==> "kernel.shmall = 524288000"
+==> "kernel.shmmax = 524288000"
+
Note for php:
==> You must uncomment that line in /etc/php/php.ini:
==> "extension=mysql.so"
@@ -105,11 +115,11 @@ Note for php:
==> "extension=openssl.so"
==> "extension=ftp.so"
==> "extension=zip.so"
-==> check and add to open_basedir "/etc" and
-==> "/srv/http/zoneminder" like so
-==> "open_basedir = /home:/tmp:/usr/share/pear:/etc:/srv/http/zoneminder"
+==> check and add to open_basedir "/etc",
+==> "/srv/http/zoneminder" and "/var/cache/zoneminder" like so
+==> "open_basedir = /home:/tmp:/usr/share/pear:/etc:/srv/http/zoneminder:/var/cache/zoneminder"
==> and set your timezone in php.ini:
-==> "date.timezone = <your_country>/<your_city>"
+==> "date.timezone = <your_zone>/<your_city>"
Note for apache:
==> You must edit /etc/httpd/conf/httpd.conf and add the line:
@@ -122,21 +132,25 @@ EOF
post_upgrade() {
post_install
+ _mysqld=$(systemctl status mysqld.service | grep -o 'inactive (dead)')
+ [[ _mysqld == 'inactive (dead)' ]] && systemctl start mysqld.service
/usr/bin/zmupdate.pl -f >/dev/null
+ [[ _mysqld == 'inactive (dead)' ]] && systemctl stop mysqld.service
}
post_remove() {
- if [[ -d /tmp/zoneminder ]]; then
- rm -vr /tmp/zoneminder
- fi
- sed -i -e '
+ _zms=$(systemctl status zoneminder.service | grep -o 'active (running)')
+ [[ _zms == 'active (running)' ]] && systemctl stop zoneminder.service
+ [[ -d /tmp/zoneminder ]] && rm -vr /tmp/zoneminder
+ sed -i '
/^open_basedir/ s/:\/srv\/http\/zoneminder//;
/^open_basedir/ s/:\/srv\/http\/zoneminder\///;
- ' /etc/php/php.ini || read
- sed -i -e '
+ /^open_basedir/ s/:\/var\/cache\/zoneminder\///
+ ' /etc/php/php.ini
+ sed -i '
/^# ZoneMinder/d;
/Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d;
- ' /etc/httpd/conf/httpd.conf || read
+ ' /etc/httpd/conf/httpd.conf
cat << EOF
Note:
==> To clean Zoneminder mysql database, run as root (with password):
@@ -165,9 +179,12 @@ Note:
==> "extension=mysqli.so"
==> "extension=session.so"
==> "extension=sockets.so"
-==> "date.timezone = <my_country>/<my_city>"
+==> "date.timezone = <my_zone>/<my_city>"
+
+==> Drop http user on video group if it isn't needed with others servers:
+==> gpasswd -d http video
-==> Edit /etc/php/php.ini and remove "/etc" and "/srv/http/zoneminder"
+==> Edit /etc/php/php.ini and remove "/etc", "/srv/http/zoneminder" and "/var/cache/zoneminder"
==> in the "open_basedir".
==> Remove log files and "zonemider" directory in "/var/log/zoneminder".