summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandros Michalopoulos2018-10-02 17:27:28 +0300
committerAlexandros Michalopoulos2018-10-02 17:27:28 +0300
commit1e837bdf49dd194445de6012006277e194a1fff1 (patch)
treeb43bfe927ecdd1b4f64b7a567bd61139a305ca5d
parent915dadcb92754961095b2b1554cedc7156538921 (diff)
downloadaur-1e837bdf49dd194445de6012006277e194a1fff1.tar.gz
v=1.32.1,r=1
-rw-r--r--.SRCINFO91
-rw-r--r--PKGBUILD241
-rw-r--r--fabs.patch11
-rw-r--r--httpd-zoneminder.conf20
-rw-r--r--log.txt23
-rw-r--r--uio.patch22
-rw-r--r--zm_rtp_ctrl.h.quick_fix_for_gcc6.diff4
-rw-r--r--zoneminder-nginx.conf39
-rw-r--r--zoneminder-php.ini9
-rw-r--r--zoneminder-tmpfile.conf3
-rw-r--r--zoneminder.install217
-rw-r--r--zoneminder.service8
12 files changed, 327 insertions, 361 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 2159c93b104..c2a78641220 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,58 +1,65 @@
pkgbase = zoneminder
- pkgdesc = Capture, analyse, record and monitor video security cameras
- pkgver = 1.30.4
+ pkgdesc = Free and open source CCTV software which supports IP, USB and analog cameras
+ pkgver = 1.32.1
pkgrel = 1
- url = https://github.com/ZoneMinder/ZoneMinder/releases
+ url = http://www.zoneminder.com
install = zoneminder.install
- arch = i686
arch = x86_64
- arch = mips64el
- arch = arm
- arch = armv7h
- license = GPL
+ license = GPLv2
makedepends = cmake
- makedepends = netpbm
- makedepends = git
+ depends = polkit
+ depends = ffmpeg
+ depends = libmp4v2
depends = mariadb
- depends = perl-dbd-mysql
- depends = perl-dbi
- depends = apache
- depends = php
- depends = php-apache
+ depends = nginx-mainline
+ depends = fcgiwrap
+ depends = php-apcu
+ depends = php-fpm
depends = php-gd
- depends = php-mcrypt
- depends = perl-php-serialization
- depends = perl-libwww
- depends = perl-net-sftp-foreign
- depends = ffmpeg
- depends = vlc
- depends = perl-sys-mmap
- depends = gnutls
- depends = polkit
- depends = perl-expect
depends = perl-archive-zip
+ depends = perl-data-dump
depends = perl-date-manip
+ depends = perl-dbd-mysql
+ depends = perl-device-serialport
+ depends = perl-file-slurp
+ depends = perl-image-info
+ depends = perl-json-any
+ depends = perl-libwww
depends = perl-mime-lite
depends = perl-mime-tools
- optdepends = php-apcu-bci: Bring back the API for android control
- optdepends = netpbm
- optdepends = cambozola
- optdepends = perl-time-modules
- optdepends = perl-x10
- optdepends = perl-astro-suntime
- backup = etc/zm.conf
- source = https://github.com/ZoneMinder/ZoneMinder/archive/1.30.4.tar.gz
- source = httpd-zoneminder.conf
+ depends = perl-number-bytes-human
+ depends = perl-sys-meminfo
+ depends = perl-sys-mmap
+ depends = perl-class-load
+ depends = perl-data-uuid
+ depends = perl-io-socket-multicast
+ depends = perl-soap-wsdl
+ depends = perl-xml-parser
+ depends = perl-lwp-protocol-https
+ depends = perl-json-maybexs
+ depends = perl-module-load-conditional
+ depends = perl-net-sftp-foreign
+ depends = perl-php-serialization
+ depends = perl-sys-cpu
+ depends = perl-uri-encode
+ optdepends = vlc: provides libvlc (may achieve better performance with some cameras)
+ optdepends = ffmpeg-full: provides libavresample (dropped from the official ffmpeg package)
+ conflicts = zoneminder-git
+ backup = etc/nginx/sites-available/zoneminder.conf
+ source = https://github.com/ZoneMinder/ZoneMinder/archive/1.32.1.tar.gz
+ source = https://github.com/FriendsOfCake/crud/archive/v3.2.0.tar.gz
+ source = https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/1.0-zm.tar.gz
+ source = zoneminder-nginx.conf
+ source = zoneminder-php.ini
source = zoneminder.service
- source = uio.patch
- source = fabs.patch
source = zoneminder-tmpfile.conf
- sha256sums = 9451683808867c2382325dd8dac6049c138fa9d407fb81d29ecf5598dc75d581
- sha256sums = ff7382b38ac07dadead0ad4d583e3dbcf8da4aaa06b76d048ee334f69f95db67
- sha256sums = 043d77a995553c533d62f48db4b719d29cf6c7074f215d866130e97be57ed646
- sha256sums = d1816cac69be5e807d22c37fcbe6fef99e38151a5c71233b875c0ebf101fb460
- sha256sums = fd20faed09eaf825933c2a87b1d04febf99d183b2b36b0041df1e2b2990c49c2
- sha256sums = cc8af737c3c07750fc71317c81999376e4bbb39da883780164a8747b3d7c95a7
+ sha256sums = a10c0c416e2127111b4d72f0046ed3a1f56708e3f4b48680848d755b01811d3c
+ sha256sums = 55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3
+ sha256sums = dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44
+ sha256sums = fed9010e55426cf05779c6161936655c7423c177c3b0b466a93853a61c79f7fe
+ sha256sums = 7905ceddbb049de0f9bf4f1eb58779dfe310a65c4d2ec44854d592d4f31b6a72
+ sha256sums = aa34c9414341eecbda4cba1a3446cf5062ab5fddc06a7f999e71916437d5f88d
+ sha256sums = d1341338538f2ac771e6b1eee9aa48e8b0da4a140024c74bc33a9f6b52443bdd
pkgname = zoneminder
diff --git a/PKGBUILD b/PKGBUILD
index 01775d37aa5..ca8f324bc82 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,5 @@
-# Maintainer: Mesmer <mesmer@fisica.if.uff.br>
+# Maintainer: Nocifer <apmichalopoulos at gmail dot com>
+# Contributor: Mesmer <mesmer@fisica.if.uff.br>
# Contributor: Troy Will <troydwill at gmail dot com>
# Contributor: /dev/rs0 </dev/rs0@secretco.de.com>
# Contributor: Jacek Burghardt <jacek@hebe.us>
@@ -10,136 +11,148 @@
# Contributor: Charles Spence IV <cspence@unomaha.edu>
# Contributor: Joe Julian <me@joejulian.name>
# Orginally based on a Debian Squeeze package
-_pkgname=zoneminder
-pkgname=zoneminder
-pkgver=1.30.4
-pkgrel=1
-pkgdesc='Capture, analyse, record and monitor video security cameras'
-arch=( i686 x86_64 mips64el arm armv7h )
-backup=( etc/zm.conf )
-url="https://github.com/ZoneMinder/ZoneMinder/releases"
-license=( GPL )
-depends=(
- mariadb perl-dbd-mysql perl-dbi
- apache php php-apache php-gd php-mcrypt perl-php-serialization
- perl-libwww perl-net-sftp-foreign
- ffmpeg vlc perl-sys-mmap
- gnutls polkit
- perl-expect perl-archive-zip perl-date-manip
- perl-mime-lite perl-mime-tools
-)
-makedepends=(
- cmake netpbm git
-)
-optdepends=(
- 'php-apcu-bci: Bring back the API for android control'
- netpbm
- cambozola
- perl-time-modules
- perl-x10
- perl-astro-suntime
-)
-install=$_pkgname.install
-source=(
- https://github.com/ZoneMinder/ZoneMinder/archive/$pkgver.tar.gz
- httpd-zoneminder.conf
- zoneminder.service
- uio.patch
- fabs.patch
- zoneminder-tmpfile.conf
-)
-sha256sums=('9451683808867c2382325dd8dac6049c138fa9d407fb81d29ecf5598dc75d581'
- 'ff7382b38ac07dadead0ad4d583e3dbcf8da4aaa06b76d048ee334f69f95db67'
- '043d77a995553c533d62f48db4b719d29cf6c7074f215d866130e97be57ed646'
- 'd1816cac69be5e807d22c37fcbe6fef99e38151a5c71233b875c0ebf101fb460'
- 'fd20faed09eaf825933c2a87b1d04febf99d183b2b36b0041df1e2b2990c49c2'
- 'cc8af737c3c07750fc71317c81999376e4bbb39da883780164a8747b3d7c95a7')
+### Important notes for version 1.32 ###
+#
+# 1) git-clone for CakePHP and Crud sources was replaced with published precompiled packages, as follows:
+# - CakePHP-Enum-Behaviour is pulled from the ZoneMinder repo, because a change is needed that has not yet been merged upstream.
+# - Crud is pulled from its official repo, since Pull Request #582 has been merged as required by the ZoneMinder devs.
+#
+# 2) Apache was switched out in favor of Nginx.
+#
+# 3) By default, ZoneMinder now runs at localhost:8095 instead of localhost/zm (this can be changed by editing the provided Nginx conf file).
+#
+# 4) For the time being Nginx and MariaDB are hard-coded as dependencies. In the future I'll look into supporting different use cases.
+
+
+#######################################################################################################################
+# #
+# Due to the many breaking changes in this release (both upstream and in the packaging), it's recommended to backup #
+# any existing ZoneMinder databases and perform a clean installation. Failure to do so may have very weird results. #
+# #
+#######################################################################################################################
+
+
+
+pkgname=zoneminder
+pkgver=1.32.1
+pkgrel=1
+pkgdesc='Free and open source CCTV software which supports IP, USB and analog cameras'
+arch=('x86_64')
+url='http://www.zoneminder.com'
+license=('GPLv2')
+depends=('polkit' 'ffmpeg' 'libmp4v2'
+ 'mariadb' 'nginx-mainline' 'fcgiwrap' 'php-apcu' 'php-fpm' 'php-gd'
+ 'perl-archive-zip' 'perl-data-dump' 'perl-date-manip' 'perl-dbd-mysql' 'perl-device-serialport' 'perl-file-slurp' 'perl-image-info'
+ 'perl-json-any' 'perl-libwww' 'perl-mime-lite' 'perl-mime-tools' 'perl-number-bytes-human' 'perl-sys-meminfo' 'perl-sys-mmap'
+ # Needed for ONVIF support
+ 'perl-class-load' 'perl-data-uuid' 'perl-io-socket-multicast' 'perl-soap-wsdl' 'perl-xml-parser'
+ # Needed for SSL support (otherwise zmupdate.pl complains there is no HTTPS support)
+ 'perl-lwp-protocol-https'
+ # Apparently needed for Telemetry support
+ 'perl-json-maybexs'
+ # Unverified dependencies. So far not installing them hasn't raised any red flags, but I can't be 100% sure whether they're leftovers from previous ZoneMinder incarnations or if they're needed for proper operation during runtime, so for the time being I'm leaving them in.
+ 'perl-module-load-conditional' 'perl-net-sftp-foreign' 'perl-php-serialization' 'perl-sys-cpu' 'perl-uri-encode')
+makedepends=('cmake')
+optdepends=('vlc: provides libvlc (may achieve better performance with some cameras)'
+ 'ffmpeg-full: provides libavresample (dropped from the official ffmpeg package)')
+conflicts=('zoneminder-git')
+backup=("etc/nginx/sites-available/$pkgname.conf")
+install=$pkgname.install
+source=("https://github.com/ZoneMinder/ZoneMinder/archive/$pkgver.tar.gz"
+ "https://github.com/FriendsOfCake/crud/archive/v3.2.0.tar.gz"
+ "https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/1.0-zm.tar.gz"
+ "zoneminder-nginx.conf"
+ "zoneminder-php.ini"
+ "zoneminder.service"
+ "zoneminder-tmpfile.conf")
+sha256sums=('a10c0c416e2127111b4d72f0046ed3a1f56708e3f4b48680848d755b01811d3c'
+ '55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3'
+ 'dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44'
+ 'fed9010e55426cf05779c6161936655c7423c177c3b0b466a93853a61c79f7fe'
+ '7905ceddbb049de0f9bf4f1eb58779dfe310a65c4d2ec44854d592d4f31b6a72'
+ 'aa34c9414341eecbda4cba1a3446cf5062ab5fddc06a7f999e71916437d5f88d'
+ 'd1341338538f2ac771e6b1eee9aa48e8b0da4a140024c74bc33a9f6b52443bdd')
+
prepare () {
- cd $srcdir/ZoneMinder-$pkgver/web/api/app/Plugin/
- if [ ! -d "crud" ]; then
- git clone -b 3.0 https://github.com/FriendsOfCake/crud.git
- mkdir -p Crud
- mv crud/* Crud
- fi
- patch $srcdir/ZoneMinder-$pkgver/src/zm_image.cpp < $srcdir/fabs.patch
- patch $srcdir/ZoneMinder-$pkgver/src/zm_comms.h < $srcdir/uio.patch
+ cd $pkgname-$pkgver
+
+ # Move extra PHP plugins into place
+ cp -R $srcdir/crud-3.2.0/* web/api/app/Plugin/Crud
+ cp -R $srcdir/CakePHP-Enum-Behavior-1.0-zm/* web/api/app/Plugin/CakePHP-Enum-Behavior
}
build() {
- cd $srcdir/ZoneMinder-$pkgver
+ cd $pkgname-$pkgver
- cmake -DCMAKE_INSTALL_PREFIX=/usr \
- -DZM_PERL_SUBPREFIX=/lib/perl5 \
- -DZM_WEBDIR=/srv/http/zoneminder \
- -DZM_CGIDIR=/srv/http/cgi-bin \
- -DZM_WEB_USER=http \
- -DZM_CONTENTDIR=/var/cache/zoneminder \
- -DZM_LOGDIR=/var/log/zoneminder \
- -DZM_RUNDIR=/run/zoneminder \
- -DZM_TMPDIR=/var/lib/zoneminder/temp \
- -DZM_SOCKDIR=/var/lib/zoneminder/sock .
-
- make V=0
-}
+ cmake -DCMAKE_INSTALL_PREFIX=/usr \
+ -DZM_CONFIG_DIR=/etc/$pkgname \
+ -DZM_CONFIG_SUBDIR=/etc/$pkgname/conf.d \
+ -DZM_RUNDIR=/run/$pkgname \
+ -DZM_SOCKDIR=/run/$pkgname \
+ -DZM_LOGDIR=/var/log/$pkgname \
+ -DZM_CONTENTDIR=/var/lib/$pkgname \
+ -DZM_CACHEDIR=/var/lib/$pkgname/cache \
+ -DZM_TMPDIR=/var/lib/$pkgname/temp \
+ -DZM_WEBDIR=/srv/$pkgname/www \
+ -DZM_CGIDIR=/srv/$pkgname/cgi-bin \
+ -DZM_WEB_USER=http .
+
+ make
+}
package() {
+ cd $pkgname-$pkgver
- cd $srcdir/ZoneMinder-$pkgver
-
- DESTDIR=$pkgdir make install
-
- # Change Polkit directory permissions to Arch Linux policy
- chmod -v 700 $pkgdir/usr/share/polkit-1/rules.d/
- chown -v polkitd $pkgdir/usr/share/polkit-1/rules.d/
-
- # BEGIN CREATE_ZONEMINDER_DIRECTORIES
- mkdir -pv $pkgdir/var/{cache/zoneminder,log/zoneminder}
- chown -Rv http.http $pkgdir/var/{cache/zoneminder,log/zoneminder}
+ make DESTDIR=$pkgdir install
- # corresponds to -DZM_SOCKDIR=/var/lib/zoneminder/sock
- mkdir -pv $pkgdir/var/lib/zoneminder/sock
- chown -v http.http $pkgdir/var/lib/zoneminder/sock
+ # Set Polkit directory permissions in accordance with Arch policy
+ chmod 750 $pkgdir/usr/share/polkit-1/rules.d
+ chown root:polkitd $pkgdir/usr/share/polkit-1/rules.d
- # corresponds to -DZM_TMPDIR=/var/lib/zoneminder/temp
- mkdir -pv $pkgdir/var/lib/zoneminder/temp
- chown -v http.http $pkgdir/var/lib/zoneminder/temp
+ # Create ZM_LOGDIR
+ mkdir -p $pkgdir/var/log/$pkgname
+ chown -R http:http $pkgdir/var/log/$pkgname
+ chmod -R 775 $pkgdir/var/log/$pkgname
- chown -v http.http $pkgdir/etc/zm.conf
- chmod 0700 $pkgdir/etc/zm.conf
- # END CREATE_ZONEMINDER_DIRECTORIES
-
- # Make content directories in /var/cache/zoneminder and to link them in /srv/http/zoneminder
- for i in events images temp; do
- mkdir $pkgdir/var/cache/$_pkgname/$i
- chown -v http.http $pkgdir/var/cache/$_pkgname/$i
- ln -s /var/cache/$_pkgname/$i $pkgdir/srv/http/$_pkgname/$i
- chown -v --no-dereference http.http $pkgdir/srv/http/$_pkgname/$i
- done
-
- # Create a link to the Zoneminder cgi binaries
- ln -sv /srv/http/cgi-bin $pkgdir/srv/http/$_pkgname
-
- chown -h http.http $pkgdir/srv/http/{cgi-bin,$_pkgname,$_pkgname/cgi-bin}
-
- # Link Cambozola
- # ln -s /usr/share/cambozola/cambozola.jar $pkgdir/srv/http/$_pkgname
-
- # Install configuration files
- mkdir -p $pkgdir/etc/httpd/conf/extra
- install -D -m 644 $srcdir/httpd-$_pkgname.conf $pkgdir/etc/httpd/conf/extra
+ # Create ZM_CONTENTDIR and its subfolders
+ mkdir -p $pkgdir/var/lib/$pkgname/{cache,events,images,temp}
+ chown -R http:http $pkgdir/var/lib/$pkgname
+ chmod -R 775 $pkgdir/var/lib/$pkgname
- mkdir -p $pkgdir/usr/lib/systemd/system
- install -D -m 644 $srcdir/$_pkgname.service $pkgdir/usr/lib/systemd/system
+ # Run script provided by upstream to create and/or link the needed folders with proper permissions
+ ./zmlinkcontent.sh -z $pkgdir/etc/$pkgname/zm.conf -w $pkgdir/srv/$pkgname/www -l $pkgdir/var/log/$pkgname -t $pkgdir/var/lib/$pkgname/temp $pkgdir/var/lib/$pkgname
- install -D -m 644 COPYING $pkgdir/usr/share/license/$_pkgname
- install -D -m 644 db/zm*.sql $pkgdir/usr/share/$_pkgname/db
+ # Link ZM_CGIDIR and ZM_CACHEDIR inside ZM_WEBDIR and set correct permissions
+ ln -s /srv/$pkgname/cgi-bin $pkgdir/srv/$pkgname/www
+ ln -s /var/lib/$pkgname/cache $pkgdir/srv/$pkgname/www
+ chown -Rh http:http $pkgdir/srv/$pkgname
- mkdir -p $pkgdir/usr/share/doc/$_pkgname
- # install -D -m 644 $srcdir/README $pkgdir/usr/share/doc/$_pkgname
+ # Set correct permissions for ZM_CONFIG_DIR & ZM_CONFIG_SUBDIR
+ chmod -R 755 $pkgdir/etc/$pkgname
+ chmod 644 $pkgdir/etc/$pkgname/zm.conf
+ chmod 644 $pkgdir/etc/$pkgname/conf.d/*
- install -Dm644 ../zoneminder-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/zoneminder.conf
+ # Install Nginx configuration
+ mkdir -p $pkgdir/etc/nginx/sites-{available,enabled}
+ install -D -m 644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
+ ln -s /etc/nginx/sites-available/$pkgname.conf $pkgdir/etc/nginx/sites-enabled/$pkgname.conf
+
+ # Install PHP-FPM custom .ini file
+ mkdir -p $pkgdir/etc/php/conf.d/
+ install -D -m 644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
+
+ # Install systemd service
+ mkdir -p $pkgdir/usr/lib/systemd/system
+ install -D -m 644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
+
+ # Install systemd tmpfile
+ mkdir -p $pkgdir/usr/lib/tmpfiles.d
+ install -D -m 644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
+ # Copy license and database schemas
+ install -D -m 644 COPYING $pkgdir/usr/share/license/$pkgname
+ install -D -m 644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
}
diff --git a/fabs.patch b/fabs.patch
deleted file mode 100644
index b0a62e3dbd9..00000000000
--- a/fabs.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/ZoneMinder-1.30.4/src/zm_image.cpp 2017-06-17 04:20:45.808503543 -0300
-+++ src/ZoneMinder-1.30.4/src/zm_image.cpp.2 2017-06-17 04:20:40.221794330 -0300
-@@ -1659,7 +1659,7 @@
- uint8_t *psrc = images[j]->buffer+c;
-
- #ifndef SOLARIS
-- if ( (unsigned)abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
-+ if ( (unsigned)fabs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
- #else
- if ( (unsigned)std::abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
- #endif
diff --git a/httpd-zoneminder.conf b/httpd-zoneminder.conf
deleted file mode 100644
index 41b364f1316..00000000000
--- a/httpd-zoneminder.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-# /etc/httpd/conf/extra/httpd-zoneminder.conf
-# Config for zoneminder web app
-
-Alias /zm "/srv/http/zoneminder"
-<Directory "/srv/http/zoneminder">
- Options -Indexes +MultiViews +FollowSymLinks
- AllowOverride None
- Order allow,deny
- Allow from all
- # Provide PHP directory and file access, see http://php.net/manual/en/ini.core.php#ini.open-basedir
- php_admin_value open_basedir "/tmp/:/etc/zm.conf:/srv/http/zoneminder/:/var/cache/zoneminder/:/var/lib/zoneminder/:/var/log/zoneminder/"
-</Directory>
-
-ScriptAlias /cgi-bin "/srv/http/cgi-bin"
-<Directory "/srv/http/cgi-bin">
- AllowOverride None
- Options +ExecCGI +FollowSymLinks
- Order allow,deny
- Allow from all
-</Directory>
diff --git a/log.txt b/log.txt
deleted file mode 100644
index 09e54b17e59..00000000000
--- a/log.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-==> Making package: zoneminder 1.30.4-1 (Fri Sep 15 20:35:45 UTC 2017)
-==> Checking runtime dependencies...
-==> Missing dependencies:
- -> mariadb
- -> perl-dbd-mysql
- -> perl-dbi
- -> apache
- -> php
- -> php-apache
- -> php-gd
- -> php-mcrypt
- -> perl-libwww
- -> vlc
- -> perl-archive-zip
- -> perl-date-manip
- -> perl-mime-lite
- -> perl-mime-tools
-==> Checking buildtime dependencies...
-==> Missing dependencies:
- -> netpbm
-==> ERROR: Could not resolve all dependencies.
-
-==> ERROR: An unknown error has occurred. Exiting...
diff --git a/uio.patch b/uio.patch
deleted file mode 100644
index a892e29b192..00000000000
--- a/uio.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- src/ZoneMinder-1.30.4/src/zm_comms.h 2017-05-09 14:54:48.000000000 +0000
-+++ src/ZoneMinder-1.30.4/src/zm_comms.fix.h 2017-09-15 20:49:46.992445289 +0000
-@@ -21,7 +21,6 @@
- #define ZM_COMMS_H
-
- #include "zm_exception.h"
--
- #include <string.h>
- #include <unistd.h>
- #include <netdb.h>
-@@ -31,11 +30,9 @@
- #include <set>
- #include <vector>
-
--#if defined(BSD)
- #include <sys/uio.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
--#endif
-
- class CommsException : public Exception
- {
diff --git a/zm_rtp_ctrl.h.quick_fix_for_gcc6.diff b/zm_rtp_ctrl.h.quick_fix_for_gcc6.diff
deleted file mode 100644
index ae076e72f8e..00000000000
--- a/zm_rtp_ctrl.h.quick_fix_for_gcc6.diff
+++ /dev/null
@@ -1,4 +0,0 @@
-126c126
-< struct Bye
----
-> struct
diff --git a/zoneminder-nginx.conf b/zoneminder-nginx.conf
new file mode 100644
index 00000000000..33fe7ab94d1
--- /dev/null
+++ b/zoneminder-nginx.conf
@@ -0,0 +1,39 @@
+server {
+ listen localhost:8095;
+ server_name localhost;
+
+ root /srv/zoneminder/www;
+
+ index index.php;
+
+ access_log /var/log/zoneminder/http_access.log;
+ error_log /var/log/zoneminder/http_error.log;
+
+ location / {
+ try_files $uri $uri/ /index.php?$args =404;
+
+ location /api {
+ rewrite ^/api(.+)$ /api/app/webroot/index.php?p=\$1 last;
+ }
+
+ location /cgi-bin {
+ include fastcgi_params;
+
+ fastcgi_param SCRIPT_FILENAME $request_filename;
+ fastcgi_param HTTP_PROXY "";
+
+ fastcgi_pass unix:/run/fcgiwrap.sock;
+ }
+
+ location ~ \.php$ {
+ include fastcgi_params;
+
+ fastcgi_param SCRIPT_FILENAME $request_filename;
+ fastcgi_param HTTP_PROXY "";
+
+ fastcgi_index index.php;
+
+ fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
+ }
+ }
+}
diff --git a/zoneminder-php.ini b/zoneminder-php.ini
new file mode 100644
index 00000000000..6f95fcf14e1
--- /dev/null
+++ b/zoneminder-php.ini
@@ -0,0 +1,9 @@
+extension=apcu
+extension=ftp
+extension=gd
+extension=gettext
+extension=pdo_mysql
+extension=sockets
+extension=zip
+
+date.timezone = PLACEHOLDER
diff --git a/zoneminder-tmpfile.conf b/zoneminder-tmpfile.conf
index 84362b52b26..441e04927b7 100644
--- a/zoneminder-tmpfile.conf
+++ b/zoneminder-tmpfile.conf
@@ -1 +1,2 @@
-d /run/zoneminder 0755 http http -
+D /run/zoneminder 0775 http http
+D /var/lib/zoneminder/temp 0775 http http
diff --git a/zoneminder.install b/zoneminder.install
index d16779e3b25..2bb7e8be126 100644
--- a/zoneminder.install
+++ b/zoneminder.install
@@ -1,130 +1,105 @@
post_install() {
-
- systemd-tmpfiles --create zoneminder.conf
-
- # 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
-
- # 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
-
- 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"
-
-EOF
+ systemctl daemon-reload
+ echo
+
+ ### MariaDB ###
+
+ # Initialize MariaDB's default database if it's not already initialized
+ if [ ! -d /var/lib/mysql/mysql ]
+ then
+ systemctl is-active --quiet mariadb && systemctl stop mariadb
+ # NOTE: This will need to be changed when MariaDB 10.2 hits the repos, as mysql_install_db has been deprecated in favor of mysqld
+ mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 2> /dev/null
+ fi
+
+ systemctl is-active --quiet mariadb || systemctl start mariadb
+
+ # Create ZoneMinder's database & user if they do not exist
+ if [ ! -d /var/lib/mysql/zm ]
+ then
+ # If a database root password is set
+ if [[ "$(mysql -uroot -e "select * from mysql.user;" 2>&1)" = *"Access denied"* ]]
+ then
+ echo \* Secure MariaDB installation found, please enter the database root password when prompted.
+ echo
+ mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
+ echo
+ echo \* 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';"
+ echo
+ # If a database root password is not set
+ else
+ 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';"
+ fi
+ fi
+
+
+ ### PHP-FPM ###
+
+ # Set local timezone in /etc/php/conf.d/zoneminder.ini
+ sed -i 's|PLACEHOLDER|'`timedatectl | grep "Time zone" | tr -s ' ' | cut -f4 -d ' '`'|g' /etc/php/conf.d/zoneminder.ini
+ systemctl is-active --quiet php-fpm && systemctl stop php-fpm
+ systemctl start php-fpm
+
+
+ ### fcgiwrap ###
+
+ systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket && systemctl stop fcgiwrap
+ systemctl start fcgiwrap.socket
+
+
+ ### Nginx ###
+
+ # Configure it with the folder structure used in Debian-based distributions
+ if [ -f /etc/nginx/nginx.conf ]
+ then
+ if ( ! grep -q 'sites-enabled' /etc/nginx/nginx.conf )
+ then
+ sed -i 's|http {|http {\'$'\n include sites-enabled/*.conf;|g' /etc/nginx/nginx.conf
+ fi
+ systemctl is-active --quiet nginx && systemctl stop nginx
+ systemctl start nginx
+ fi
+
+
+ ### ZoneMinder
+
+ # Also activate the tmpfile to create runtime directories
+ systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+ systemd-tmpfiles --create
+ systemctl start zoneminder
+
+ echo Done!
+ echo
+ echo ZoneMinder is listening at http://localhost:8095
+ echo
}
post_upgrade() {
post_install
- /usr/bin/zmupdate.pl -f >/dev/null
+
+ # Make sure ZoneMinder is running before we attempt to use its updater
+ if ( systemctl is-active --quiet zoneminder )
+ then
+ /usr/bin/zmupdate.pl -f 1> /dev/null
+ else
+ echo ---------------
+ echo
+ echo Error performing database update, zoneminder.service could not be started. Please fix any issues and manually run \'/usr/bin/zmupdater.pl -f\'
+ echo
+ fi
}
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
-
- 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"
-==> "echo 'delete from db where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql"
-==> "mysqladmin --defaults-file=/etc/mysql/my.cnf -p -f drop zm"
-==> (or without password):
-==> "echo 'delete from user where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf mysql"
-==> "echo 'delete from db where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf mysql"
-==> "mysqladmin --defaults-file=/etc/mysql/my.cnf -f drop zm"
-
-==> Disable http with php if it isn't needed with others servers,
-==> comment or remove that lines in /etc/httpd/conf/httpd.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=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 "zoneminder" directory in "/var/log/zoneminder".
-
-==> Backup and remove "events", "images" and "temp" dirs in "/var/cache/zoneminder".
-EOF
+ systemctl daemon-reload && systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+ echo
+ echo ZoneMinder\'s database and user have been left intact. You can remove them by running the following:
+ echo
+ echo mysql -uroot -p -e \"drop database zm\;\"
+ echo mysql -uroot -p -e \"drop user \'zmuser\'@localhost\;\"
+ echo
+ echo If you haven\'t yet configured a password for the database root user, omit the \'-p\' option.
+ echo
}
diff --git a/zoneminder.service b/zoneminder.service
index 48268f1391d..f825d6cee75 100644
--- a/zoneminder.service
+++ b/zoneminder.service
@@ -1,7 +1,8 @@
[Unit]
-Description=ZoneMinder CCTV recording and security system
-After=network.target mysqld.service httpd.service
-Requires=mysqld.service httpd.service
+Description=ZoneMinder - CCTV Monitoring and Recording System
+Requires=mariadb.service
+Wants= nginx.service php-fpm.service fcgiwrap.socket
+After=network.target mariadb.service nginx.service
[Service]
User=http
@@ -10,6 +11,7 @@ ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/usr/bin/zmpkg.pl stop
PIDFile=/run/zoneminder/zm.pid
+Environment=TZ=:/etc/localtime
[Install]
WantedBy=multi-user.target