diff options
Diffstat (limited to 'pcr/zoneminder/zoneminder.install')
-rw-r--r-- | pcr/zoneminder/zoneminder.install | 235 |
1 files changed, 93 insertions, 142 deletions
diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install index 1c8789a4a..d16779e3b 100644 --- a/pcr/zoneminder/zoneminder.install +++ b/pcr/zoneminder/zoneminder.install @@ -1,145 +1,98 @@ -#!/usr/bin/bash -pre_install() { - set -e - abort=false - if [ -L /srv/http/zoneminder/events ]; then - l=$(readlink /srv/http/zoneminder/events) - if [ $l != /var/cache/zoneminder/events ]; then - abort=true - fi - fi - if [ -L /srv/http/zoneminder/images ]; then - l=$(readlink /srv/http/zoneminder/images) - if [ $l != /var/cache/zoneminder/images ]; then - abort=true - fi - fi - if [ $abort = true ]; then - cat >&2 << EOF -Aborting installation of zoneminder due to non-default symlinks in -/srv/http/zoneminder for the images and/or events directory, which could -result in loss of data. Please move your data in each of these directories to -/var/cache/zoneminder before installing zoneminder from the package. -EOF - exit 1 - fi - exit 0 -} - post_install() { - if [[ -d /var/log/zoneminder ]]; then - chmod -v 0755 /var/log/zoneminder - chown -v http.http /var/log/zoneminder - else - mkdir -vm 0755 /var/log/zoneminder - chown -v http.http /var/log/zoneminder - fi - if [[ -d /tmp/zoneminder ]]; then - chmod -v 0700 /tmp/zoneminder - chown -v http.http /tmp/zoneminder - else - mkdir -vm 0700 /tmp/zoneminder - chown -v http.http /tmp/zoneminder - fi - # edit /etc/php.ini for Zoneminder - sed -e ' - # Enable these libraries by removing the leading comment character - \|^;extension=mysql.so$| s|^;||; - \|^;extension=mysqli.so$| s|^;||; - \|^;extension=pdo_mysql.so$| s|^;||; - \|^;extension=gd.so$| s|^;||; - \|^;extension=gettext.so$| s|^;||; - \|^;extension=mcrypt.so$| s|^;||; - \|^;extension=session.so$| s|^;||; - \|^;extension=sockets.so$| s|^;||; - \|^;extension=openssl.so$| s|^;||; - \|^;extension=ftp.so$| s|^;||; - \|^;extension=zip.so$| s|^;||; - - # Add zoneminder paths to open_basedir - s|^open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/$|&:/etc:/srv/http/zoneminder/|; - ' /etc/php/php.ini > /etc/php/php.ini.zoneminder + systemd-tmpfiles --create zoneminder.conf - # edit /etc/httpd/conf/httpd.conf for Zoneminder - sed -e ' - # Use mod_mpm_prefork instead of mod_mpm_event.so (FS#39218). - s|^LoadModule mpm_event_module modules/mod_mpm_event.so$|#&\nLoadModule mpm_prefork_module modules/mod_mpm_prefork.so|; - - # Zoneminder requires cgi - \|^#LoadModule cgi_module modules/mod_cgi.so$| s|#||; - - # libphp5 - \|^LoadModule php5_module modules/libphp5.so$|d; - s|^#*LoadModule rewrite_module modules/mod_rewrite.so$|&\nLoadModule php5_module modules/libphp5.so|; - \|^Include /etc/httpd/conf/extra/php5_module.conf|d; - s|^Include conf/extra/httpd-default.conf$|&\nInclude /etc/httpd/conf/extra/php5_module.conf|; - - # Include httpd-zoneminder.conf - \|^Include /etc/httpd/conf/extra/httpd-zoneminder.conf$|d; - s|^# Server-pool management (MPM specific)$|\nInclude /etc/httpd/conf/extra/httpd-zoneminder.conf\n&|; - ' /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf.zoneminder + # edit /etc/php.ini for Zoneminder + sed -e ' + # Enable these libraries by removing the leading comment character + \|^;extension=ftp.so$| s|^;||; + \|^;extension=gd.so$| s|^;||; + \|^;extension=gettext.so$| s|^;||; + \|^;extension=mcrypt.so$| s|^;||; + \|^;extension=openssl.so$| s|^;||; + \|^;extension=pdo_mysql.so$| s|^;||; + \|^;extension=sockets.so$| s|^;||; + \|^;extension=zip.so$| s|^;||; + ' /etc/php/php.ini > /tmp/php.ini.zoneminder - cat << EOF -Note for mysql: -==> To run Zoneminder, you must install the database running mysql service (as root): -==> "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" -==> "echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql" -==> (or without passsword): -==> "mysqladmin --defaults-file=/etc/mysql/my.cnf -f reload" -==> "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" + # edit /etc/httpd/conf/httpd.conf for Zoneminder + sed -e ' + # Use mod_mpm_prefork instead of mod_mpm_event.so (FS#39218). + s|^LoadModule mpm_event_module modules/mod_mpm_event.so$|#&\nLoadModule mpm_prefork_module modules/mod_mpm_prefork.so|; + + # Zoneminder needs Apache configured to permit CGI execution + \|^\t#LoadModule cgi_module modules/mod_cgi.so$| s|\t#|\t|; + + # libphp7 + \|^LoadModule php7_module modules/libphp7.so$|d; + s|^#*LoadModule rewrite_module modules/mod_rewrite.so$|&\nLoadModule php7_module modules/libphp7.so|; + \|^Include /etc/httpd/conf/extra/php7_module.conf|d; + s|^Include conf/extra/httpd-default.conf$|&\nInclude /etc/httpd/conf/extra/php7_module.conf|; + + # Include httpd-zoneminder.conf + \|^Include /etc/httpd/conf/extra/httpd-zoneminder.conf$|d; + s|^# Server-pool management (MPM specific)$|\nInclude /etc/httpd/conf/extra/httpd-zoneminder.conf\n&|; + ' /etc/httpd/conf/httpd.conf > /tmp/httpd.conf.zoneminder + + cat << EOF -Note for php: -==> You must uncomment that line in /etc/php/php.ini: -==> "extension=mysql.so" -==> check and make sure these are uncommented: -==> "extension=gd.so" -==> "extension=gettext.so" -==> "extension=mcrypt.so" -==> "extension=mysqli.so" -==> "extension=session.so" -==> "extension=sockets.so" -==> "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" -==> and set your timezone in php.ini: -==> "date.timezone = <your_country>/<your_city>" + Zoneminder database setup: + -------------------------- + Zoneminder operation requires a database named 'zm' which is defined in /usr/share/zoneminder/db/zm_create.sql + + Create the Zoneminder database (with a password): + "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" + "echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql" + (or without a password): + "mysqladmin --defaults-file=/etc/mysql/my.cnf -f reload" + "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" + + PHP configuration + ----------------- + * Check and make sure these are uncommented in /etc/php/php.ini: + extension=ftp.so + extension=gd.so + extension=gettext.so + extension=mcrypt.so + extension=openssl.so + extension=pdo_mysql.so + extension=sockets.so + extension=zip.so + * Set your timezone in php.ini: + date.timezone = <your_country>/<your_city> + + Apache configuration + -------------------- + Edit /etc/httpd/conf/httpd.conf and add the line: + "LoadModule php7_module modules/libphp7.so" + and: + "Include /etc/httpd/conf/extra/php7_module.conf" + "Include /etc/httpd/conf/extra/httpd-zoneminder.conf" -Note for apache: -==> You must edit /etc/httpd/conf/httpd.conf and add the line: -==> "LoadModule php5_module modules/libphp5.so" -==> and: -==> "Include /etc/httpd/conf/extra/php5_module.conf" -==> "Include /etc/httpd/conf/extra/httpd-zoneminder.conf" EOF } post_upgrade() { - post_install - /usr/bin/zmupdate.pl -f >/dev/null + post_install + /usr/bin/zmupdate.pl -f >/dev/null } post_remove() { - if [[ -d /tmp/zoneminder ]]; then - rm -vr /tmp/zoneminder - fi - #sed -i -e ' - # /^open_basedir/ s/:\/srv\/http\/zoneminder//; - # /^open_basedir/ s/:\/srv\/http\/zoneminder\///; - # ' /etc/php/php.ini || read - #sed -i -e ' - # /^# ZoneMinder/d; - # /Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d; - # ' /etc/httpd/conf/httpd.conf || read + if [[ -d /tmp/zoneminder ]]; then + rm -vr /tmp/zoneminder + fi + # sed -i -e ' + # /^open_basedir/ s/:\/srv\/http\/zoneminder//; + # /^open_basedir/ s/:\/srv\/http\/zoneminder\///; + # ' /etc/php/php.ini || read + # sed -i -e ' + # /^# ZoneMinder/d; + # /Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d; + # ' /etc/httpd/conf/httpd.conf || read - cat << EOF + cat << EOF Note: ==> To clean Zoneminder mysql database, run as root (with password): ==> "echo 'delete from user where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql" @@ -152,27 +105,25 @@ Note: ==> Disable http with php if it isn't needed with others servers, ==> comment or remove that lines in /etc/httpd/conf/httpd.conf: -==> "LoadModule php5_module modules/libphp5.so" -==> "Include /etc/httpd/conf/extra/php5_module.conf" +==> "LoadModule php7_module modules/libphp7.so" +==> "Include /etc/httpd/conf/extra/php7_module.conf" ==> Remove line in /etc/httpd/conf/httpd.conf: ==> "Include /etc/httpd/conf/extra/httpd-zoneminder.conf" ==> Disable php with mysql if it isn't needed with others servers, ==> comment that lines in /etc/php/php.ini: -==> "extension=mysql.so" -==> "extension=gd.so" -==> "extension=gettext.so" -==> "extension=mcrypt.so" -==> "extension=mysqli.so" -==> "extension=session.so" -==> "extension=sockets.so" -==> "date.timezone = <my_country>/<my_city>" - -==> Edit /etc/php/php.ini and remove "/etc" and "/srv/http/zoneminder" -==> in the "open_basedir". + # extension=ftp.so + # extension=gd.so + # extension=gettext.so + # extension=mcrypt.so + # extension=openssl.so + # extension=pdo_mysql.so + # extension=sockets.so + # extension=zip.so + # "date.timezone = <my_country>/<my_city>" -==> Remove log files and "zonemider" directory in "/var/log/zoneminder". +==> Remove log files and "zoneminder" directory in "/var/log/zoneminder". ==> Backup and remove "events", "images" and "temp" dirs in "/var/cache/zoneminder". EOF |