diff options
Diffstat (limited to 'pcr/zoneminder/zoneminder.install')
-rw-r--r-- | pcr/zoneminder/zoneminder.install | 133 |
1 files changed, 59 insertions, 74 deletions
diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install index 66109d5fa..1c8789a4a 100644 --- a/pcr/zoneminder/zoneminder.install +++ b/pcr/zoneminder/zoneminder.install @@ -5,13 +5,13 @@ pre_install() { if [ -L /srv/http/zoneminder/events ]; then l=$(readlink /srv/http/zoneminder/events) if [ $l != /var/cache/zoneminder/events ]; then - abort=true + 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 + abort=true fi fi if [ $abort = true ]; then @@ -41,49 +41,45 @@ post_install() { mkdir -vm 0700 /tmp/zoneminder chown -v http.http /tmp/zoneminder fi - sed -i ' - /^;extension=mysql.so/ s/^;//; - /^#extension=mysql.so/ s/^#//; - /^;extension=mysqli.so/ s/^;//; - /^#extension=mysqli.so/ s/^#//; - /^;extension=gd.so/ s/^;//; - /^#extension=gd.so/ s/^#//; - /^;extension=gettext.so/ s/^;//; - /^#extension=gettext.so/ s/^#//; - /^;extension=mcrypt.so/ s/^;//; - /^#extension=mcrypt.so/ s/^#//; - /^;extension=session.so/ s/^;//; - /^#extension=session.so/ s/^#//; - /^;extension=sockets.so/ s/^;//; - /^#extension=sockets.so/ s/^#//; - /^;extension=openssl.so/ s/^;//; - /^#extension=openssl.so/ s/^#//; - /^;extension=ftp.so/ s/^;//; - /^#extension=ftp.so/ s/^#//; - /^;extension=zip.so/ s/^;//; - /^#extension=zip.so/ s/^#//; - /^;open_basedir/ s/^;//; - /^#open_basedir/ s/^#//; - /^open_basedir/ s/:\/etc//; - /^open_basedir/ s/:\/etc\///; - /^open_basedir/ s/$/:\/etc/; - /^open_basedir/ s/:\/srv\/http\/zoneminder//; - /^open_basedir/ s/:\/srv\/http\/zoneminder\///; - /^open_basedir/ s/$/:\/srv\/http\/zoneminder/; - /^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; - /^# ZoneMinder/d; - /^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 - gpasswd -a http video + + # 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 + + # 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 + cat << EOF Note for mysql: ==> To run Zoneminder, you must install the database running mysql service (as root): @@ -97,11 +93,6 @@ 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" @@ -115,11 +106,11 @@ Note for php: ==> "extension=openssl.so" ==> "extension=ftp.so" ==> "extension=zip.so" -==> 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" +==> 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_zone>/<your_city>" +==> "date.timezone = <your_country>/<your_city>" Note for apache: ==> You must edit /etc/httpd/conf/httpd.conf and add the line: @@ -132,25 +123,22 @@ 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() { - _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 - sed -i ' - /^# ZoneMinder/d; - /Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d; - ' /etc/httpd/conf/httpd.conf + 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 Note: ==> To clean Zoneminder mysql database, run as root (with password): @@ -179,12 +167,9 @@ Note: ==> "extension=mysqli.so" ==> "extension=session.so" ==> "extension=sockets.so" -==> "date.timezone = <my_zone>/<my_city>" - -==> Drop http user on video group if it isn't needed with others servers: -==> gpasswd -d http video +==> "date.timezone = <my_country>/<my_city>" -==> Edit /etc/php/php.ini and remove "/etc", "/srv/http/zoneminder" and "/var/cache/zoneminder" +==> Edit /etc/php/php.ini and remove "/etc" and "/srv/http/zoneminder" ==> in the "open_basedir". ==> Remove log files and "zonemider" directory in "/var/log/zoneminder". |