summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV'yacheslav Stetskevych <slava18@gmail.com>2010-07-09 02:38:22 -0400
committerRobby Workman <rworkman@slackbuilds.org>2010-07-10 02:17:47 -0500
commit6149f3636948188bbad6377fa1f4425591f6fe22 (patch)
tree924b5c6e6dadcaf8f33aaab84abf4211f4bfa828
parent944d84608d9bf501dd16124307fcab77ee5d688d (diff)
downloadslackbuilds-6149f3636948188bbad6377fa1f4425591f6fe22.tar.gz
system/ZoneMinder: Added (security and surveillance solution)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
-rw-r--r--system/ZoneMinder/README17
-rw-r--r--system/ZoneMinder/README.PERLDEPS31
-rw-r--r--system/ZoneMinder/README.SLACKWARE60
-rw-r--r--system/ZoneMinder/ZoneMinder.SlackBuild172
-rw-r--r--system/ZoneMinder/ZoneMinder.info14
-rw-r--r--system/ZoneMinder/doinst.sh33
-rw-r--r--system/ZoneMinder/patches/02_destdir-fix.patch15
-rw-r--r--system/ZoneMinder/patches/03_libjpegv8.patch50
-rw-r--r--system/ZoneMinder/patches/04_streaming-update.patch39
-rw-r--r--system/ZoneMinder/patches/db_upgrade_script_location.patch11
-rw-r--r--system/ZoneMinder/patches/zm_build_fix.patch11
-rw-r--r--system/ZoneMinder/patches/zm_create.sql.in.patch28
-rw-r--r--system/ZoneMinder/slack-desc19
-rw-r--r--system/ZoneMinder/zm_apache.conf9
-rw-r--r--system/ZoneMinder/zm_logrotate9
15 files changed, 518 insertions, 0 deletions
diff --git a/system/ZoneMinder/README b/system/ZoneMinder/README
new file mode 100644
index 0000000000..b057b49f89
--- /dev/null
+++ b/system/ZoneMinder/README
@@ -0,0 +1,17 @@
+ZoneMinder is a Linux video camera security and surveillance solution.
+
+This suite is intended for use in single or multi-camera video
+security applications, commercial or home CCTV. It supports capture,
+analysis, recording, and monitoring of video data. PTZ cameras can
+be controlled via web or semi-automatically using a variety of
+protocols. It can also be integrated into a home automation system
+via X.10 or other protocols. This build includes cambozola and jscalendar.
+
+This requires perl-Date-Manip, libwww-perl, perl-PHP-Serialization, and
+perl-Sys-Mmap. Optional dependencies are ffmpeg (video streaming and
+recoding support), perl-Archive-Zip (automatic event uploading), perl-X10
+(integration with X10-based home automation), perl-Device-SerialPort
+(RS232/RS485 PTZ camera control), perl-MIME-Lite, and perl-MIME-Entity
+(automatic event mail notification).
+
+See README.SLACKWARE for configuration information.
diff --git a/system/ZoneMinder/README.PERLDEPS b/system/ZoneMinder/README.PERLDEPS
new file mode 100644
index 0000000000..43c0eb6e4c
--- /dev/null
+++ b/system/ZoneMinder/README.PERLDEPS
@@ -0,0 +1,31 @@
+README-PERLDEPS.TXT
+This file summarizes perl dependencies for ZoneMinder 1.24.2.
+Exact modules Zoneminder needs are noted in square brackets.
+Packages that I (V'yacheslav Stetskevych) maintain, are marked with (x).
+
+perl-Date-Manip [Date::Manip] (x)
+ \- perl-Test-Pod-Coverage [Test::Pod::Coverage] (x)
+ \- perl-Pod-Coverage [Pod::Coverage] (x)
+ \- perl-Devel-Symdump [Devel::Symdump] (x)
+ \- perl-YAML-Syck [YAML::Syck] (x)
+ \- perl-Test-Pod [Test::Pod]
+ \- perl-Test-Inter [Test::Inter] (x)
+libwww-perl [LWP::UserAgent]
+ \- URI (bundled with Slackware)
+ \- perl-html-tagset [HTML::Tagset]
+ \- perl-html-parser [HTML::Parser]
+perl-PHP-Serialization [PHP::Serialization] (x)
+perl-Archive-Zip [Archive::Zip]
+perl-MIME-Lite [MIME::Lite] (x)
+ \- perl-Email-Date-Format [Email::Date::Format] (x)
+perl-MIME-tools [MIME::Entity]
+ \- perl-IO-stringy [IO::Stringy]
+ \- perl-MailTools [Mail::Header]
+ \- perl-TimeDate [Date::Format]
+ \- perl-Test-Pod [Test::Pod]
+perl-Sys-Mmap [Sys::Mmap] (x)
+perl-Device-SerialPort [Device::SerialPort] (x)
+perl-X10 [X10::ActiveHome] (x)
+ \- perl-Time-modules [Time::ParseDate] (x)
+ \- perl-Astro-SunTime [Astro::SunTime] (x)
+
diff --git a/system/ZoneMinder/README.SLACKWARE b/system/ZoneMinder/README.SLACKWARE
new file mode 100644
index 0000000000..a6330bc00e
--- /dev/null
+++ b/system/ZoneMinder/README.SLACKWARE
@@ -0,0 +1,60 @@
+README.SLACKWARE
+Written by V'yacheslav Stetskevych <slava18@gmail.com>
+
+This build uses the mmap method for camera access, as opposed to shared memory.
+That means, there is no need to configure shared memory limits any more.
+You can revert back to the shm method by removing --enable-mmap from the build.
+
+To use ZoneMinder, you need to have Apache, PHP and MySQL.
+
+CONFIGURATION
+# Be sure to follow the dircetions in /etc/rc.d/rc.mysqld before you try and
+ setup your database.
+
+1) Database setup:
+# mysql -u root -p
+source /usr/share/ZoneMinder/db/zm_create.sql
+use mysql;
+grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
+quit;
+
+Reload the mysql server with "mysqladmin reload".
+
+2) Apache configuration:
+Uncomment mod_php at the end of /etc/httpd/httpd.conf.
+Add this line to httpd.conf:
+ Include /etc/zm/zm_apache.conf
+
+# You may need to chmod +x /etc/rc.d/rc.httpd first
+Restart apache with "/etc/rc.d/rc.httpd restart".
+
+## NOTE: This should be fixed in perl-Date-Manip and not needed now. ###
+3) Populate /etc/timezone (fixes zmfilter.pl): #
+perl-Date-Manip requires the file /etc/timezone to be present. #
+Slackware does not ship this file, so use this script to populate it: #
+ #
+ localTime="$(readlink /etc/localtime-copied-from)"; #
+ echo ${localTime#*/usr/share/zoneinfo/} > /etc/timezone #
+########################################################################
+
+To make ZoneMinder launch on system boot:
+/etc/rc.d/rc.local:
+==================================
+if [ -x /etc/rc.d/rc.zm ]; then
+ /etc/rc.d/rc.zm start
+fi
+
+/etc/rc.d/rc.local_shutdown:
+==================================
+if [ -x /etc/rc.d/rc.zm ]; then
+ /etc/rc.d/rc.zm stop
+fi
+
+Database upgrade files are provided in /usr/share/ZoneMinder/db.
+
+See http://www.zoneminder.com/wiki/index.php/Documentation#Logging for info
+on how to counter the massive amount of syslog spam that ZoneMinder generates.
+
+The ZoneMinder web interface shall be available at http://hostname/zm/
+
+Have fun!
diff --git a/system/ZoneMinder/ZoneMinder.SlackBuild b/system/ZoneMinder/ZoneMinder.SlackBuild
new file mode 100644
index 0000000000..39bc1cf870
--- /dev/null
+++ b/system/ZoneMinder/ZoneMinder.SlackBuild
@@ -0,0 +1,172 @@
+#!/bin/sh
+
+# Slackware build script for ZoneMinder
+
+# Copyright 2010 V'yacheslav Stetskevych <slava18@gmail.com>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Heavily modified by the SlackBuilds.org project 2010 --dsomero
+
+PRGNAM=ZoneMinder
+VERSION=${VERSION:-1.24.2}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CAMBOZOLA_VERSION=${CAMBOZOLA_VERSION:-0.76} # Java streaming client
+JSCALENDAR_VERSION=${JSCALENDAR_VERSION:-1.0} # Calendar plugin (use 1.0 here)
+DOCOWN=${DOCOWN:-apache}
+DOCGRP=${DOCGRP:-apache}
+DOCROOT=${DOCROOT:-"/srv/httpd/htdocs/zm"}
+CGIROOT=${CGIROOT:-"/srv/httpd/cgi-bin"}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+tar xvf $CWD/cambozola-$CAMBOZOLA_VERSION.tar.gz
+unzip $CWD/jscalendar-$JSCALENDAR_VERSION.zip
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Apply all the patches in $CWD/patches
+for patch in $CWD/patches/* ; do
+ patch -p1 < $patch
+done
+
+# Regenerate files for automake/autoconf.
+autoreconf
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS -D__STDC_CONSTANT_MACROS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc/zm \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux \
+ --with-libarch=lib${LIBDIRSUFFIX} \
+ --with-mysql=/usr \
+ --with-ffmpeg=/usr \
+ --with-webdir=$DOCROOT \
+ --with-cgidir=$CGIROOT \
+ --with-webuser=$DOCOWN \
+ --with-webgroup=$DOCGRP \
+ --disable-crashtrace \
+ --disable-debug \
+ --enable-mmap=yes
+
+make
+make install DESTDIR=$PKG INSTALLDIRS=vendor INSTALLVENDORMAN3DIR=/usr/man/man3
+
+# Strip binaries
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Compress manpages
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+
+# Remove junk files and dirs
+find $PKG -name perllocal.pod \
+ -o -name ".packlist" \
+ -o -name "*.bs" \
+ | xargs rm -f || true
+
+find $PKG/usr -depth -type d -empty -delete || true
+
+mkdir -p $PKG/var/{log,lock/subsys}
+install -d -o $DOCOWN -g $DOCGRP $PKG/var/log/zm
+
+for DIR in events images sound; do
+ install -d -o $DOCOWN -g $DOCGRP $PKG$DOCROOT/$DIR
+done
+
+# Install logrotate script
+mkdir -p $PKG/etc/logrotate.d/
+cat $CWD/zm_logrotate > $PKG/etc/logrotate.d/zm.new
+
+# Install apache config
+sed "s%@DOCROOT@%$DOCROOT%" $CWD/zm_apache.conf > $PKG/etc/zm/zm_apache.conf.new
+
+# Do not clobber the config file
+mv $PKG/etc/zm/zm.conf $PKG/etc/zm/zm.conf.new
+
+# Install startup script
+install -D -m 755 scripts/zm $PKG/etc/rc.d/rc.zm.new
+
+# Install cambozola
+install -m 644 cambozola-$CAMBOZOLA_VERSION/dist/cambozola.jar $PKG$DOCROOT
+
+# Install jscalendar
+mkdir -p $PKG$DOCROOT/tools/jscalendar
+cp -Rp jscalendar-$JSCALENDAR_VERSION/* $PKG$DOCROOT/tools/jscalendar
+
+mkdir -p $PKG/usr/share/$PRGNAM/db
+cp -a db/zm_create.sql db/zm_update-*.sql $PKG/usr/share/$PRGNAM/db
+
+# Copy documentation
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a AUTHORS ChangeLog INSTALL NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
+cat $CWD/README.PERLDEPS > $PKG/usr/doc/$PRGNAM-$VERSION/README.PERLDEPS
+
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/ZoneMinder/ZoneMinder.info b/system/ZoneMinder/ZoneMinder.info
new file mode 100644
index 0000000000..3d0a69f89a
--- /dev/null
+++ b/system/ZoneMinder/ZoneMinder.info
@@ -0,0 +1,14 @@
+PRGNAM="ZoneMinder"
+VERSION="1.24.2"
+HOMEPAGE="http://www.zoneminder.com"
+DOWNLOAD="http://www2.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz \
+ http://www.charliemouse.com:8080/code/cambozola/cambozola-0.76.tar.gz \
+ http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip"
+MD5SUM="550d2f8f08852134028c3b1cf8fa437f \
+ 30c17059bbba8da69bb971b4082eb712 \
+ 10f2160fe68294013efcd1473cd36f72"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="V'yacheslav Stetskevych"
+EMAIL="slava18@gmail.com"
+APPROVED="dsomero"
diff --git a/system/ZoneMinder/doinst.sh b/system/ZoneMinder/doinst.sh
new file mode 100644
index 0000000000..45b15510f2
--- /dev/null
+++ b/system/ZoneMinder/doinst.sh
@@ -0,0 +1,33 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep same perms on rc.zm.new:
+if [ -e etc/rc.d/rc.zm ]; then
+ cp -a etc/rc.d/rc.zm etc/rc.d/rc.zm.new.incoming
+ cat etc/rc.d/rc.zm.new > etc/rc.d/rc.zm.new.incoming
+ mv etc/rc.d/rc.zm.new.incoming etc/rc.d/rc.zm.new
+fi
+
+config etc/rc.d/rc.zm.new
+config etc/zm/zm.conf.new
+config etc/zm/zm_apache.conf.new
+config etc/logrotate.d/zm.new
+
+echo ""
+echo " If this is a new installation, you will need to create a MySQL database"
+echo " for ZoneMinder to use. See /usr/doc/ZoneMinder-<version>/README.SLACKWARE"
+echo ""
+echo " If you are upgrading, you will need to run the zmupdate.pl script:"
+echo " /usr/bin/zmupdate.pl version=<from version> [--user=<my_database_user> --pass=<my_database_pass>]"
+echo ""
+
diff --git a/system/ZoneMinder/patches/02_destdir-fix.patch b/system/ZoneMinder/patches/02_destdir-fix.patch
new file mode 100644
index 0000000000..759e3e494f
--- /dev/null
+++ b/system/ZoneMinder/patches/02_destdir-fix.patch
@@ -0,0 +1,15 @@
+--- ZoneMinder-1.24.2/Makefile.am.orig 2006-12-25 01:21:07.000000000 +0000
++++ ZoneMinder-1.24.2/Makefile.am 2006-12-25 01:22:04.000000000 +0000
+@@ -23,9 +23,9 @@
+ # Yes, you are correct. This is a HACK!
+ install-data-hook:
+ ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
+- -( if ! test -e $(RUNDIR); then mkdir $(RUNDIR); fi )
+- ( if ! test -e $(ZM_RUNDIR); then mkdir $(ZM_RUNDIR); fi; chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR) )
++ -( if ! test -e $(DESTDIR)$(RUNDIR); then @mkdir_p@ $(DESTDIR)$(RUNDIR); fi )
++ ( if ! test -e $(DESTDIR)$(ZM_RUNDIR); then @mkdir_p@ $(DESTDIR)$(ZM_RUNDIR); fi; chown $(webuser):$(webgroup) $(DESTDIR)$(ZM_RUNDIR); chmod u+w $(DESTDIR)$(ZM_RUNDIR) )
+
+ uninstall-hook:
+ @-( cd $(DESTDIR)$(webdir); rm -rf events graphics images sounds temp )
+- @-( rm -rf $(ZM_RUNDIR) )
++ @-( rm -rf $(DESTDIR)$(ZM_RUNDIR) )
diff --git a/system/ZoneMinder/patches/03_libjpegv8.patch b/system/ZoneMinder/patches/03_libjpegv8.patch
new file mode 100644
index 0000000000..6f74e59640
--- /dev/null
+++ b/system/ZoneMinder/patches/03_libjpegv8.patch
@@ -0,0 +1,50 @@
+--- ZoneMinder-1.24.2/src/zm_jpeg.h~ 2009-03-20 13:07:00.000000000 +0100
++++ ZoneMinder-1.24.2/src/zm_jpeg.h 2010-02-09 22:58:08.576509968 +0100
+@@ -36,5 +36,5 @@
+ void zm_jpeg_emit_message( j_common_ptr cinfo, int msg_level );
+
+ // Prototypes for memory compress/decompression object */
+-void jpeg_mem_src(j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size );
+-void jpeg_mem_dest(j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size );
++void zm_jpeg_mem_src(j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size );
++void zm_jpeg_mem_dest(j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size );
+--- ZoneMinder-1.24.2/src/zm_jpeg.c~ 2009-03-20 13:07:00.000000000 +0100
++++ ZoneMinder-1.24.2/src/zm_jpeg.c 2010-02-09 22:58:34.660048754 +0100
+@@ -173,7 +173,7 @@
+ * for closing it after finishing compression.
+ */
+
+-void jpeg_mem_dest (j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size )
++void zm_jpeg_mem_dest (j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size )
+ {
+ mem_dest_ptr dest;
+
+@@ -350,7 +350,7 @@
+ * for closing it after finishing decompression.
+ */
+
+-void jpeg_mem_src( j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size )
++void zm_jpeg_mem_src( j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size )
+ {
+ mem_src_ptr src;
+
+--- ZoneMinder-1.24.2/src/zm_image.cpp~ 2009-05-25 20:04:00.000000000 +0200
++++ ZoneMinder-1.24.2/src/zm_image.cpp 2010-02-09 22:58:53.219635716 +0100
+@@ -461,7 +461,7 @@
+ return( false );
+ }
+
+- jpeg_mem_src( cinfo, inbuffer, inbuffer_size );
++ zm_jpeg_mem_src( cinfo, inbuffer, inbuffer_size );
+
+ jpeg_read_header( cinfo, TRUE );
+
+@@ -523,7 +523,7 @@
+ jpeg_create_compress( cinfo );
+ }
+
+- jpeg_mem_dest( cinfo, outbuffer, outbuffer_size );
++ zm_jpeg_mem_dest( cinfo, outbuffer, outbuffer_size );
+
+ cinfo->image_width = width; /* image width and height, in pixels */
+ cinfo->image_height = height;
diff --git a/system/ZoneMinder/patches/04_streaming-update.patch b/system/ZoneMinder/patches/04_streaming-update.patch
new file mode 100644
index 0000000000..067158cccd
--- /dev/null
+++ b/system/ZoneMinder/patches/04_streaming-update.patch
@@ -0,0 +1,39 @@
+--- original/web/includes/functions.php 2009-05-08 12:17:10.000000000 +0300
++++ patched/web/includes/functions.php 2010-04-13 22:44:27.000000000 +0300
+@@ -820,7 +820,7 @@
+ $version = $logVersion[1];
+ $browser = 'konqueror';
+ }
+- elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'],$logVersion))
++ elseif (ereg( 'Opera/([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'],$logVersion))
+ {
+ $version = $logVersion[1];
+ $browser = 'opera';
+@@ -844,6 +844,18 @@
+ return( $browser == "mozilla" );
+ }
+
++function isOpera()
++{
++ getBrowser( $browser, $version );
++ return( $browser == "opera" );
++}
++
++function isSafari()
++{
++ getBrowser( $browser, $version );
++ return( $browser == "safari" );
++}
++
+ function isKonqueror()
+ {
+ getBrowser( $browser, $version );
+@@ -875,7 +887,7 @@
+
+ function canStreamNative()
+ {
+- return( ZM_CAN_STREAM == "yes" || ( ZM_CAN_STREAM == "auto" && (isNetscape() || isKonqueror()) ) );
++ return( ZM_CAN_STREAM == "yes" || ( ZM_CAN_STREAM == "auto" && (isNetscape() || isKonqueror() || isOpera() || isSafari()) ) );
+ }
+
+ function canStreamApplet()
diff --git a/system/ZoneMinder/patches/db_upgrade_script_location.patch b/system/ZoneMinder/patches/db_upgrade_script_location.patch
new file mode 100644
index 0000000000..ca32afc34c
--- /dev/null
+++ b/system/ZoneMinder/patches/db_upgrade_script_location.patch
@@ -0,0 +1,11 @@
+--- ZoneMinder-1.24.1/zm.conf.in.orig 2009-03-23 13:55:43.000000000 +0000
++++ ZoneMinder-1.24.1/zm.conf.in 2009-03-23 13:57:22.000000000 +0000
+@@ -13,7 +13,7 @@
+ ZM_VERSION=@VERSION@
+
+ # Path to build directory, used mostly for finding DB upgrade scripts
+-ZM_PATH_BUILD=@PATH_BUILD@
++ZM_PATH_BUILD=/usr/share/ZoneMinder
+
+ # Build time, used to record when to trigger various checks
+ ZM_TIME_BUILD=@TIME_BUILD@
diff --git a/system/ZoneMinder/patches/zm_build_fix.patch b/system/ZoneMinder/patches/zm_build_fix.patch
new file mode 100644
index 0000000000..164a106893
--- /dev/null
+++ b/system/ZoneMinder/patches/zm_build_fix.patch
@@ -0,0 +1,11 @@
+diff -u -ru ZoneMinder-1.24.2-old//src/zm_utils.cpp ZoneMinder-1.24.2/src/zm_utils.cpp
+--- ZoneMinder-1.24.2-old//src/zm_utils.cpp 2010-06-03 01:34:27.981235559 +0300
++++ ZoneMinder-1.24.2/src/zm_utils.cpp 2010-06-03 01:44:52.108291327 +0300
+@@ -20,6 +20,7 @@
+ //#include "zm_debug.h"
+ #include "zm_utils.h"
+
++#include <cstdio>
+ #include <stdarg.h>
+
+ const std::string stringtf( const char *format, ... )
diff --git a/system/ZoneMinder/patches/zm_create.sql.in.patch b/system/ZoneMinder/patches/zm_create.sql.in.patch
new file mode 100644
index 0000000000..5441de6423
--- /dev/null
+++ b/system/ZoneMinder/patches/zm_create.sql.in.patch
@@ -0,0 +1,28 @@
+diff --git ZoneMinder-1.24.2/db/zm_create.sql.in ZoneMinder-1.24.2-ta/db/zm_create.sql.in
+index fc7eb5d..e2bda24 100644
+--- ZoneMinder-1.24.2/db/zm_create.sql.in
++++ ZoneMinder-1.24.2-ta/db/zm_create.sql.in
+@@ -642,7 +642,7 @@ insert into Config set Id = 38, Name = 'ZM_HTTP_TIMEOUT', Value = '2500', Type =
+ insert into Config set Id = 39, Name = 'ZM_MIN_RTP_PORT', Value = '40200', Type = 'integer', DefaultValue = '40200', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'Minimum port that ZoneMinder will listen for RTP traffic on', Help = 'When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the minimum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting.', Category = 'network', Readonly = '0', Requires = '';
+ insert into Config set Id = 40, Name = 'ZM_MAX_RTP_PORT', Value = '40499', Type = 'integer', DefaultValue = '40499', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'Maximum port that ZoneMinder will listen for RTP traffic on', Help = 'When ZoneMinder communicates with MPEG4 capable cameras using RTP with the unicast method it must open ports for the camera to connect back to for control and streaming purposes. This setting specifies the maximum port number that ZoneMinder will use. Ordinarily two adjacent ports are used for each camera, one for control packets and one for data packets. This port should be set to an even number, you may also need to open up a hole in your firewall to allow cameras to connect back if you wish to use unicasting. You should also ensure that you have opened up at least two ports for each monitor that will be connecting to unicasting network cameras.', Category = 'network', Readonly = '0', Requires = '';
+ insert into Config set Id = 41, Name = 'ZM_OPT_FFMPEG', Value = '1', Type = 'boolean', DefaultValue = 'yes', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Is the ffmpeg video encoder/decoder installed', Help = 'ZoneMinder can optionally encode a series of video images into an MPEG encoded movie file for viewing, downloading or storage. This option allows you to specify whether you have the ffmpeg tools installed. Note that creating MPEG files can be fairly CPU and disk intensive and is not a required option as events can still be reviewed as video streams without it.', Category = 'images', Readonly = '0', Requires = '';
+-insert into Config set Id = 42, Name = 'ZM_PATH_FFMPEG', Value = '/usr/local/bin/ffmpeg', Type = 'string', DefaultValue = '/usr/local/bin/ffmpeg', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to (optional) ffmpeg mpeg encoder', Help = 'This path should point to where ffmpeg has been installed.', Category = 'images', Readonly = '0', Requires = 'ZM_OPT_FFMPEG=1';
++insert into Config set Id = 42, Name = 'ZM_PATH_FFMPEG', Value = '/usr/bin/ffmpeg', Type = 'string', DefaultValue = '/usr/bin/ffmpeg', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to (optional) ffmpeg mpeg encoder', Help = 'This path should point to where ffmpeg has been installed.', Category = 'images', Readonly = '0', Requires = 'ZM_OPT_FFMPEG=1';
+ insert into Config set Id = 43, Name = 'ZM_FFMPEG_INPUT_OPTIONS', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'Additional input options to ffmpeg', Help = 'Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the input to ffmpeg (options that are given before the -i option). Check the ffmpeg documentation for a full list of options which may be used here.', Category = 'images', Readonly = '0', Requires = 'ZM_OPT_FFMPEG=1';
+ insert into Config set Id = 44, Name = 'ZM_FFMPEG_OUTPUT_OPTIONS', Value = '-r 25', Type = 'string', DefaultValue = '-r 25', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'Additional output options to ffmpeg', Help = 'Ffmpeg can take many options on the command line to control the quality of video produced. This option allows you to specify your own set that apply to the output from ffmpeg (options that are given after the -i option). Check the ffmpeg documentation for a full list of options which may be used here. The most common one will often be to force an output frame rate supported by the video encoder.', Category = 'images', Readonly = '0', Requires = 'ZM_OPT_FFMPEG=1';
+ insert into Config set Id = 45, Name = 'ZM_FFMPEG_FORMATS', Value = 'mpg mpeg wmv asf avi* mov swf 3gp**', Type = 'string', DefaultValue = 'mpg mpeg wmv asf avi* mov swf 3gp**', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'Formats to allow for ffmpeg video generation', Help = 'Ffmpeg can generate video in many different formats. This option allows you to list the ones you want to be able to select. As new formats are supported by ffmpeg you can add them here and be able to use them immediately. Adding a \'*\' after a format indicates that this will be the default format used for web video, adding \'**\' defines the default format for phone video.', Category = 'images', Readonly = '0', Requires = 'ZM_OPT_FFMPEG=1';
+@@ -653,11 +653,11 @@ insert into Config set Id = 49, Name = 'ZM_RECORD_DIAG_IMAGES', Value = '0', Typ
+ insert into Config set Id = 50, Name = 'ZM_EXTRA_DEBUG', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Switch additional debugging on', Help = 'ZoneMinder binary components usually have several levels of debug information they can output. Normally this is set to a fairly low level to avoid filling logs too quickly. This options lets you switch on other options that allow you to configure additional debug information to be output. Components will pick up this instruction when they are restarted.', Category = 'debug', Readonly = '0', Requires = '';
+ insert into Config set Id = 51, Name = 'ZM_EXTRA_DEBUG_TARGET', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'What components should have extra debug enabled', Help = 'There are three scopes of debug available. Leaving this option blank means that all components will use extra debug (not recommended). Setting this option to \'_<component>\', e.g. _zmc, will limit extra debug to that component only. Setting this option to \'_<component>_<identity>\', e.g. \'_zmc_m1\' will limit extra debug to that instance of the component only. This is ordinarily what you probably want to do.', Category = 'debug', Readonly = '0', Requires = 'ZM_EXTRA_DEBUG=1';
+ insert into Config set Id = 52, Name = 'ZM_EXTRA_DEBUG_LEVEL', Value = '0', Type = 'integer', DefaultValue = '0', Hint = '0|1|2|3|4|5|6|7|8|9', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'What level of extra debug should be enabled', Help = 'There are 9 levels of debug available, with higher numbers being more debug and level 0 being no debug. However not all levels are used by all components. Also if there is debug at a high level it is usually likely to be output at such a volume that it may obstruct normal operation. For this reason you should set the level carefully and cautiously until the degree of debug you wish to see is present.', Category = 'debug', Readonly = '0', Requires = 'ZM_EXTRA_DEBUG=1';
+-insert into Config set Id = 53, Name = 'ZM_EXTRA_DEBUG_LOG', Value = '/tmp/zm_debug.log+', Type = 'string', DefaultValue = '/tmp/zm_debug.log+', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'Where extra debug is output to', Help = 'Depending on your system configuration you may find that only errors, warning and informational messages are logged to your system log. This option allows you to specify an additional target for these messages and debug. This also has the advantage of partitioning debug for the component you are tracing, from messages from other components. Be warned however that if this is a simple filename and you are debugging several components then they will all try and write to the same file with undesirable consequences. Appending a \'+\' to the filename will cause the file to be created with a \'.<pid>\' suffix containing your process id. In this way debug from each run of a component is kept separate. This is the recommended setting as it will also prevent subsequent runs from overwriting the same log.', Category = 'debug', Readonly = '0', Requires = 'ZM_EXTRA_DEBUG=1';
++insert into Config set Id = 53, Name = 'ZM_EXTRA_DEBUG_LOG', Value = '/var/log/zm/zm_debug.log+', Type = 'string', DefaultValue = '/var/log/zm/zm_debug.log+', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'Where extra debug is output to', Help = 'Depending on your system configuration you may find that only errors, warning and informational messages are logged to your system log. This option allows you to specify an additional target for these messages and debug. This also has the advantage of partitioning debug for the component you are tracing, from messages from other components. Be warned however that if this is a simple filename and you are debugging several components then they will all try and write to the same file with undesirable consequences. Appending a \'+\' to the filename will cause the file to be created with a \'.<pid>\' suffix containing your process id. In this way debug from each run of a component is kept separate. This is the recommended setting as it will also prevent subsequent runs from overwriting the same log.', Category = 'debug', Readonly = '0', Requires = 'ZM_EXTRA_DEBUG=1';
+ insert into Config set Id = 54, Name = 'ZM_DUMP_CORES', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Create core files on unexpected process failure.', Help = 'When an unrecoverable error occurs in a ZoneMinder binary process is has traditionally been trapped and the details written to logs to aid in remote analysis. However in some cases it is easier to diagnose the error if a core file, which is a memory dump of the process at the time of the error, is created. This can be interactively analysed in the debugger and may reveal more or better information than that available from the logs. This option is recommended for advanced users only otherwise leave at the default. Note using this option to trigger core files will mean that there will be no indication in the binary logs that a process has died, they will just stop, however the zmdc log will still contain an entry. Also note that you may have to explicitly enable core file creation on your system via the \'ulimit -c\' command or other means otherwise no file will be created regardless of the value of this option.', Category = 'debug', Readonly = '0', Requires = '';
+ insert into Config set Id = 55, Name = 'ZM_PATH_MAP', Value = '/dev/shm', Type = 'string', DefaultValue = '/dev/shm', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the mapped memory files that that ZoneMinder can use', Help = 'ZoneMinder has historically used IPC shared memory for shared data between processes. This has it\'s advantages and limitations. This version of ZoneMinder can use an alternate method, mapped memory, instead with can be enabled with the --enable--mmap directive to configure. This requires less system configuration and is generally more flexible. However it requires each shared data segment to map onto a filesystem file. This option indicates where those mapped files go. You should ensure that this location has sufficient space for these files and for the best performance it should be a tmpfs file system or ramdisk otherwise disk access may render this method slower than the regular shared memory one.', Category = 'paths', Readonly = '0', Requires = '';
+-insert into Config set Id = 56, Name = 'ZM_PATH_SOCKS', Value = '/tmp', Type = 'string', DefaultValue = '/tmp', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the various Unix domain socket files that ZoneMinder uses', Help = 'ZoneMinder generally uses Unix domain sockets where possible. This reduces the need for port assignments and prevents external applications from possibly compromising the daemons. However each Unix socket requires a .sock file to be created. This option indicates where those socket files go.', Category = 'paths', Readonly = '0', Requires = '';
+-insert into Config set Id = 57, Name = 'ZM_PATH_LOGS', Value = '/tmp', Type = 'string', DefaultValue = '/tmp', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the various logs that the ZoneMinder daemons generate', Help = 'There are various daemons that are used by ZoneMinder to perform various tasks. Most generate helpful log files and this is where they go. They can be deleted if not required for debugging.', Category = 'paths', Readonly = '0', Requires = '';
++insert into Config set Id = 56, Name = 'ZM_PATH_SOCKS', Value = '/var/run/zm', Type = 'string', DefaultValue = '/var/run/zm', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the various Unix domain socket files that ZoneMinder uses', Help = 'ZoneMinder generally uses Unix domain sockets where possible. This reduces the need for port assignments and prevents external applications from possibly compromising the daemons. However each Unix socket requires a .sock file to be created. This option indicates where those socket files go.', Category = 'paths', Readonly = '0', Requires = '';
++insert into Config set Id = 57, Name = 'ZM_PATH_LOGS', Value = '/var/log/zm', Type = 'string', DefaultValue = '/var/log/zm', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to the various logs that the ZoneMinder daemons generate', Help = 'There are various daemons that are used by ZoneMinder to perform various tasks. Most generate helpful log files and this is where they go. They can be deleted if not required for debugging.', Category = 'paths', Readonly = '0', Requires = '';
+ insert into Config set Id = 58, Name = 'ZM_PATH_SWAP', Value = '/tmp', Type = 'string', DefaultValue = '/tmp', Hint = '/absolute/path/to/somewhere', Pattern = '(?-xism:^((?:/[^/]*)+?)/?$)', Format = ' $1 ', Prompt = 'Path to location for temporary swap images used in streaming', Help = 'Buffered playback requires temporary swap images to be stored for each instance of the streaming daemons. This option determines where these images will be stored. The images will actually be stored in sub directories beneath this location and will be automatically cleaned up after a period of time.', Category = 'paths', Readonly = '0', Requires = '';
+ insert into Config set Id = 59, Name = 'ZM_WEB_TITLE_PREFIX', Value = 'ZM', Type = 'string', DefaultValue = 'ZM', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'The title prefix displayed on each window', Help = 'If you have more than one installation of ZoneMinder it can be helpful to display different titles for each one. Changing this option allows you to customise the window titles to include further information to aid identification.', Category = 'web', Readonly = '0', Requires = '';
+ insert into Config set Id = 60, Name = 'ZM_WEB_RESIZE_CONSOLE', Value = '1', Type = 'boolean', DefaultValue = 'yes', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Should the console window resize itself to fit', Help = 'Traditionally the main ZoneMinder web console window has resized itself to shrink to a size small enough to list only the monitors that are actually present. This is intended to make the window more unobtrusize but may not be to everyones tastes, especially if opened in a tab in browsers which support this kind if layout. Switch this option off to have the console window size left to the users preference', Category = 'web', Readonly = '0', Requires = '';
diff --git a/system/ZoneMinder/slack-desc b/system/ZoneMinder/slack-desc
new file mode 100644
index 0000000000..1667ccdaa5
--- /dev/null
+++ b/system/ZoneMinder/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+ZoneMinder: ZoneMinder (Linux video camera security and surveillance solution)
+ZoneMinder:
+ZoneMinder: This suite is intended for use in single or multi-camera video
+ZoneMinder: security applications, commercial or home CCTV. It supports capture,
+ZoneMinder: analysis, recording, and monitoring of video data. PTZ cameras can
+ZoneMinder: be controlled via web or semi-automatically using a variety of
+ZoneMinder: protocols. It can also be integrated into a home automation system
+ZoneMinder: via X.10 or other protocols. This build includes cambozola and
+ZoneMinder: jscalendar.
+ZoneMinder:
+ZoneMinder: Homepage: http://www.zoneminder.com/
diff --git a/system/ZoneMinder/zm_apache.conf b/system/ZoneMinder/zm_apache.conf
new file mode 100644
index 0000000000..1fc10c54d3
--- /dev/null
+++ b/system/ZoneMinder/zm_apache.conf
@@ -0,0 +1,9 @@
+<Directory "@DOCROOT@">
+ AllowOverride FileInfo Options
+ Options FollowSymLinks
+ php_flag register_globals off
+ php_flag short_open_tag on
+ <IfModule dir_module>
+ DirectoryIndex index.php
+ </IfModule>
+</Directory>
diff --git a/system/ZoneMinder/zm_logrotate b/system/ZoneMinder/zm_logrotate
new file mode 100644
index 0000000000..72c736c6df
--- /dev/null
+++ b/system/ZoneMinder/zm_logrotate
@@ -0,0 +1,9 @@
+/var/log/zm/*log {
+ weekly
+ rotate 4
+ notifempty
+ missingok
+ postrotate
+ /usr/bin/zmpkg.pl logrot
+ endscript
+}