summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTroy Will2015-07-26 21:40:12 -0700
committerTroy Will2015-07-26 21:40:12 -0700
commit9547e68d54527f371913d8ad1f070c17beec1dd4 (patch)
tree7a6d50ed75a8ff95940eed7f66c60e84bae1f6e7
downloadaur-9547e68d54527f371913d8ad1f070c17beec1dd4.tar.gz
Initial commit
-rw-r--r--.SRCINFO52
-rw-r--r--PKGBUILD126
-rw-r--r--httpd-zoneminder.conf20
-rw-r--r--zoneminder.install126
-rw-r--r--zoneminder.service17
5 files changed, 341 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..88628d9da12
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,52 @@
+pkgbase = zoneminder-git
+ pkgdesc = Capture, analyse, record and monitor video security cameras
+ pkgver = 1.28.1
+ pkgrel = 2
+ url = https://github.com/ZoneMinder/ZoneMinder/releases
+ install = zoneminder.install
+ arch = i686
+ arch = x86_64
+ arch = mips64el
+ arch = arm
+ arch = armv7h
+ license = GPL
+ makedepends = cmake
+ makedepends = make
+ makedepends = gcc
+ makedepends = netpbm
+ depends = mariadb
+ depends = perl-dbd-mysql
+ depends = perl-dbi
+ depends = apache
+ depends = php
+ depends = php-apache
+ 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-date-manip
+ depends = perl-mime-lite
+ depends = perl-mime-tools
+ optdepends = netpbm
+ optdepends = cambozola
+ optdepends = perl-time-modules
+ optdepends = perl-x10
+ optdepends = perl-astro-suntime
+ backup = etc/zm.conf
+ source = git://github.com/zoneminder/zoneminder.git
+ source = httpd-zoneminder.conf
+ source = zoneminder.service
+ sha256sums = SKIP
+ sha256sums = c2ca71ec57e53da040de61ff212ac063574e5ddfb4c333b70be060d5ec26c62c
+ sha256sums = 7eb2f26246e240e23502da44854d5ed14485aa11bc448ad73e9b57fee13f00a3
+
+pkgname = zoneminder-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..ffb5129073e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,126 @@
+# Maintainer: Troy Will <troydwill at gmail dot com>
+# Contributor: Charles Spence IV <cspence@unomaha.edu>
+# Contributor: /dev/rs0 </dev/rs0@secretco.de.com>
+# Contributor: Jacek Burghardt <jacek@hebe.us>
+# Contributor: Vojtech Aschenbrenner <v@asch.cz>
+# Contributor: Jason Gardner <buhrietoe@gmail.com>
+# Contributor: Ross melin <rdmelin@gmail.com>
+# Contributor (Parabola): Márcio Silva <coadde@lavabit.com>
+# Contributor (Parabola): André Silva <emulatorman@lavabit.com>
+# Orginally based on a Debian Squeeze package
+_pkgname=zoneminder
+pkgname=zoneminder-git
+pkgver=1.28.1
+pkgrel=2
+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 make gcc netpbm
+)
+optdepends=(
+ netpbm
+ cambozola
+ perl-time-modules
+ perl-x10
+ perl-astro-suntime
+)
+install=$_pkgname.install
+
+source=(
+ git://github.com/$_pkgname/$_pkgname.git
+ httpd-zoneminder.conf
+ zoneminder.service
+)
+# Because the source is not static, skip Git checksum:
+sha256sums=('SKIP'
+ 'c2ca71ec57e53da040de61ff212ac063574e5ddfb4c333b70be060d5ec26c62c'
+ '7eb2f26246e240e23502da44854d5ed14485aa11bc448ad73e9b57fee13f00a3')
+
+pkgver() {
+ cd "$_pkgname"
+ printf "%s.r%s.%s.%s" "$pkgver" "$(git rev-list --count HEAD)" "$pkgrel" "$(git rev-parse --short HEAD)"
+}
+
+build() {
+ cd $srcdir/$_pkgname
+
+ # ZM_PERL_SUBPREFIX=/lib/perl5 flag added to force Perl modules
+ # to /usr/lib/perl5/ on non i686 architectures
+
+ 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=/srv/zoneminder \
+ -DZM_TMPDIR=/srv/zoneminder/tmp \
+ -DZM_SOCKDIR=/srv/zoneminder/socks .
+
+ make V=0
+}
+
+package() {
+
+ cd $srcdir/$_pkgname
+
+ 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}
+
+ mkdir -pv $pkgdir/srv/zoneminder/socks
+ chown -v http.http $pkgdir/srv/zoneminder/socks
+
+ mkdir -pv $pkgdir/srv/zoneminder/tmp
+ chown -v http.http $pkgdir/srv/zoneminder/tmp
+
+ 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
+
+ mkdir -p $pkgdir/usr/lib/systemd/system
+ install -D -m 644 $srcdir/$_pkgname.service $pkgdir/usr/lib/systemd/system
+
+ 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/httpd-zoneminder.conf b/httpd-zoneminder.conf
new file mode 100644
index 00000000000..7e6c8e37508
--- /dev/null
+++ b/httpd-zoneminder.conf
@@ -0,0 +1,20 @@
+# /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 access to important directories
+ php_admin_value open_basedir "/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/zm.conf:/srv/http/zoneminder/:/var/cache/zoneminder/:/srv/zoneminder/socks/:/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/zoneminder.install b/zoneminder.install
new file mode 100644
index 00000000000..e890c604834
--- /dev/null
+++ b/zoneminder.install
@@ -0,0 +1,126 @@
+post_install() {
+ # 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 > /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 needs Apache configured to permit CGI execution
+ \|^\t#LoadModule cgi_module modules/mod_cgi.so$| s|\t#|\t|;
+
+ # 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
+
+ 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
+ * Add /etc/zm.conf, /srv/http/zoneminder, /var/cache/zoneminder, and /srv/zoneminder/socks to open_basedir in the zoneminder vhosts configuration file in apache:
+ php_admin_value open_basedir "/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/zm.conf:/srv/http/zoneminder/:/var/cache/zoneminder/:/srv/zoneminder/socks/:/var/log/zoneminder/"
+ * 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 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_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 php5_module modules/libphp5.so"
+==> "Include /etc/httpd/conf/extra/php5_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=sockets.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
+}
diff --git a/zoneminder.service b/zoneminder.service
new file mode 100644
index 00000000000..4ba74584450
--- /dev/null
+++ b/zoneminder.service
@@ -0,0 +1,17 @@
+# ZoneMinder systemd unit file for Arch Linux
+
+[Unit]
+Description=ZoneMinder CCTV recording and security system
+After=network.target mysqld.service httpd.service
+Requires=mysqld.service httpd.service
+
+[Service]
+User=http
+Type=forking
+ExecStart=/usr/bin/zmpkg.pl start
+ExecReload=/usr/bin/zmpkg.pl restart
+ExecStop=/usr/bin/zmpkg.pl stop
+PIDFile="/srv/zoneminder/zm.pid"
+
+[Install]
+WantedBy=multi-user.target