diff options
Diffstat (limited to 'pcr/zoneminder/zoneminder.install')
-rw-r--r-- | pcr/zoneminder/zoneminder.install | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install index ecacf6437..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/^;//; @@ -72,8 +73,8 @@ post_install() { /^open_basedir/ s/:\/var\/cache\/zoneminder//; /^open_basedir/ s/:\/var\/cache\/zoneminder\///; /^open_basedir/ s/$/:\/var\/cache\/zoneminder/; - ' /etc/php/php.ini || read - sed -i -e ' + ' /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; @@ -81,12 +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" @@ -96,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" @@ -126,22 +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\///; /^open_basedir/ s/:\/var\/cache\/zoneminder\/// - ' /etc/php/php.ini || read - sed -i -e ' + ' /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): |