From 21dd16c0e1bda70142051e14c513c6ad3bc5a031 Mon Sep 17 00:00:00 2001 From: Gene Baxter Date: Fri, 2 Jan 2015 14:06:57 +0700 Subject: system/ZoneMinder: Added (video camera security and surveillance). Signed-off-by: Willy Sudiarto Raharjo --- system/ZoneMinder/README | 16 ++++ system/ZoneMinder/README.SLACKWARE | 50 ++++++++++ system/ZoneMinder/ZoneMinder.SlackBuild | 163 ++++++++++++++++++++++++++++++++ system/ZoneMinder/ZoneMinder.info | 14 +++ system/ZoneMinder/doinst.sh | 37 ++++++++ system/ZoneMinder/slack-desc | 19 ++++ system/ZoneMinder/zm_apache.conf | 9 ++ system/ZoneMinder/zm_logrotate | 9 ++ 8 files changed, 317 insertions(+) create mode 100644 system/ZoneMinder/README create mode 100644 system/ZoneMinder/README.SLACKWARE create mode 100644 system/ZoneMinder/ZoneMinder.SlackBuild create mode 100644 system/ZoneMinder/ZoneMinder.info create mode 100644 system/ZoneMinder/doinst.sh create mode 100644 system/ZoneMinder/slack-desc create mode 100644 system/ZoneMinder/zm_apache.conf create mode 100644 system/ZoneMinder/zm_logrotate diff --git a/system/ZoneMinder/README b/system/ZoneMinder/README new file mode 100644 index 0000000000..dad3b73d4e --- /dev/null +++ b/system/ZoneMinder/README @@ -0,0 +1,16 @@ +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. + +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.SLACKWARE b/system/ZoneMinder/README.SLACKWARE new file mode 100644 index 0000000000..af5a641bdd --- /dev/null +++ b/system/ZoneMinder/README.SLACKWARE @@ -0,0 +1,50 @@ +README.SLACKWARE + +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 -u root -p". + +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". + +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..4c9acc1aad --- /dev/null +++ b/system/ZoneMinder/ZoneMinder.SlackBuild @@ -0,0 +1,163 @@ +#!/bin/sh + +# Slackware build script for ZoneMinder + +# Copyright 2014 Gene Baxter +# 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. + +PRGNAM=ZoneMinder +VERSION=${VERSION:-1.27.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CAMBOZOLA_VERSION=${CAMBOZOLA_VERSION:-0.935} # 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 || tar xvf $CWD/v$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 -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Regenerate files for automake/autoconf. +./bootstrap.sh + +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-debug \ + --enable-mmap=yes + +make +make install DESTDIR=$PKG INSTALLDIRS=vendor INSTALLVENDORMAN3DIR=/usr/man/man3 + +# Strip binaries +find $PKG -print0 | xargs -0 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 644 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 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 + + +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..7ab5d0c056 --- /dev/null +++ b/system/ZoneMinder/ZoneMinder.info @@ -0,0 +1,14 @@ +PRGNAM="ZoneMinder" +VERSION="1.27.0" +HOMEPAGE="http://www.zoneminder.com" +DOWNLOAD="https://github.com/ZoneMinder/ZoneMinder/archive/v1.27.0.tar.gz \ + http://www.andywilcock.com/code/cambozola/cambozola-0.935.tar.gz \ + http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip" +MD5SUM="9ff149baa1a0d04931fbafcdb3200fab \ + 6c48fd994685d4d72668850eeb613e24 \ + 10f2160fe68294013efcd1473cd36f72" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="perl-Date-Manip perl-Sys-Mmap perl-LWP-Protocol-https" +MAINTAINER="Gene Baxter" +EMAIL="GenoBob@gmail.com" diff --git a/system/ZoneMinder/doinst.sh b/system/ZoneMinder/doinst.sh new file mode 100644 index 0000000000..09e7f396ef --- /dev/null +++ b/system/ZoneMinder/doinst.sh @@ -0,0 +1,37 @@ +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... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +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 +preserve_perms etc/rc.d/rc.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-/README.SLACKWARE" +echo "" +echo " If you are upgrading, you will need to run the zmupdate.pl script:" +echo " /usr/bin/zmupdate.pl version= [--user= --pass=]" +echo "" diff --git a/system/ZoneMinder/slack-desc b/system/ZoneMinder/slack-desc new file mode 100644 index 0000000000..9fab3eb3d3 --- /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 ':' except on otherwise blank lines. + + |-----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 @@ + + AllowOverride FileInfo Options + Options FollowSymLinks + php_flag register_globals off + php_flag short_open_tag on + + DirectoryIndex index.php + + 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 +} -- cgit v1.2.3