summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2014-12-20 17:12:23 (GMT)
committerBritney Fransen <brfransen@gmail.com>2014-12-20 17:12:23 (GMT)
commitcc90fc2cb2d57a6bf9b040001f8950fff50c967a (patch)
treec6408835943e349cf11f933e1f7687f418a71048
parentf7ae4ba2fd32b939353f06c9f39d7dcdbd229601 (diff)
downloadlinhes_pkgbuild-cc90fc2cb2d57a6bf9b040001f8950fff50c967a.zip
linhes_pkgbuild-cc90fc2cb2d57a6bf9b040001f8950fff50c967a.tar.gz
linhes_pkgbuild-cc90fc2cb2d57a6bf9b040001f8950fff50c967a.tar.bz2
zoneminder: update to 1.28
-rw-r--r--abs/core/zoneminder/PKGBUILD310
-rw-r--r--abs/core/zoneminder/__changelog19
-rw-r--r--abs/core/zoneminder/gen_light_zm.conf1
-rw-r--r--abs/core/zoneminder/httpd-zoneminder.conf4
-rw-r--r--abs/core/zoneminder/patch-ffmpeg-0.11.patch60
-rw-r--r--abs/core/zoneminder/zoneminder63
-rw-r--r--abs/core/zoneminder/zoneminder.install224
-rw-r--r--abs/core/zoneminder/zoneminder.service15
8 files changed, 293 insertions, 403 deletions
diff --git a/abs/core/zoneminder/PKGBUILD b/abs/core/zoneminder/PKGBUILD
index 33118bd..75b3301 100644
--- a/abs/core/zoneminder/PKGBUILD
+++ b/abs/core/zoneminder/PKGBUILD
@@ -1,218 +1,136 @@
-# Maintainer: Vojtech Aschenbrenner <v@asch.cz>
+# Contributor: Troy Will <troydwill@gmail.com>
+# 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>
-# Maintainer (Parabola): Márcio Silva <coadde@lavabit.com>
+# Contributor (Parabola): Márcio Silva <coadde@lavabit.com>
# Contributor (Parabola): André Silva <emulatorman@lavabit.com>
-
-# based of debian squeeze package
-
+# Orginally based on a Debian Squeeze package
+
+pkgbase=zoneminder
pkgname=zoneminder
-pkgver=1.25.0
-pkgrel=23
+pkgver=1.28.0
+pkgrel=1
pkgdesc='Capture, analyse, record and monitor video security cameras'
-arch=(
- i686
- x86_64
- mips64el
-)
-backup=(
- etc/zm.conf
-)
-url="http://www.$pkgname.com"
-license=(
- GPL
-)
+arch=( i686 x86_64 mips64el arm )
+
+backup=( etc/zm.conf )
+url="https://github.com/ZoneMinder/ZoneMinder/releases"
+license=( GPL )
+
depends=(
- #apache
- lighttpd
- cambozola
- #ffmpeg-static
- ffmpeg
- gnutls
- mysql
- perl-archive-zip
- perl-date-manip
- perl-dbd-mysql
- perl-dbi
- perl-expect
- perl-libwww
- perl-mime-lite
- perl-mime-tools
- perl-php-serialization
- perl-net-sftp-foreign
- perl-sys-mmap
- perl-time-modules
- perl-x10
- php
- #php-apache
- php-gd
- php-mcrypt
+ lighttpd
+ cambozola
+ gnutls
+ mysql
+ perl-archive-zip
+ perl-date-manip
+ perl-dbd-mysql
+ perl-dbi
+ perl-expect
+ perl-libwww
+ perl-mime-lite
+ perl-mime-tools
+ perl-php-serialization
+ perl-net-sftp-foreign
+ perl-sys-mmap
+ perl-time-modules
+ perl-x10
+ php
+ #php-apache
+ php-gd
+ php-mcrypt
)
+
makedepends=(
- netpbm
+ netpbm
+ cmake
)
+
optdepends=(
- netpbm
+ netpbm
)
-install=$pkgname.install
+
+install=$pkgbase.install
+
source=(
- http://www.$pkgname.com/downloads/ZoneMinder-$pkgver.tar.gz
- httpd-$pkgname.conf
- $pkgname
- $pkgname.service
- patch-ffmpeg-0.11.patch
- zm.include
- zm.sysctrl.conf
- zm_gen_light.conf
+ https://github.com/ZoneMinder/ZoneMinder/archive/v$pkgver.tar.gz
+ httpd-zoneminder.conf
+ zoneminder.service
+ zm.include
+ zm.sysctrl.conf
+ zm_gen_light.conf
)
-
+
build() {
- cd $srcdir/ZoneMinder-$pkgver
-
- # ZM_RUNDIR need change to run dir
- export CPPFLAGS=-D__STDC_CONSTANT_MACROS\
- ZM_LOGDIR=/var/log/$pkgname\
- ZM_RUNDIR=/tmp/$pkgname\
- ZM_SSL_LIB=gnutls\
- ZM_TMPDIR=/tmp/$pkgname
-
- # Patch for GCC 4.7.x
- sed -i -e 's/^#include <errno.h>/#include <errno.h>\n#include <unistd.h>/'\
- src/zm_logger.cpp || read
- sed -i -e 's/^#include <pthread.h>/#include <pthread.h>\n#include <unistd.h>/'\
- src/zm_thread.h || read
-
- # Patch for automake 1.12
- sed -i -e '/am__api_version=/ s/1.11/1.12/'\
- configure || read
-
- # Patch for disable ZM_CHECK_FOR_UPDATES
- sed -i -e '/ZM_CHECK_FOR_UPDATES/,+1 s/yes/no/'\
- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read
-
- # Patch for support html5 video and flv
- sed -i -e '/ZM_MPEG_LIVE_FORMAT/,+1 s/swf/webm/;/ZM_MPEG_REPLAY_FORMAT/,+1 s/swf/webm/;
- /ZM_FFMPEG_FORMATS/,+1 s/mpg mpeg wmv asf avi\* mov swf 3gp\*\*/mpg mpeg wmv asf avi\* mov flv swf 3gp\*\* webm ogg h254/'\
- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read
-
- # Patch for change path run dir
- sed -i -e '/ZM_PATH_SOCKS/,+1 s/TMP/RUN/'\
- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read
-
- # Patch for change ZM name to ZoneMinder
- sed -i -e '/ZM_WEB_TITLE_PREFIX/,+1 s/"ZM"/"ZoneMinder"/'\
- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read
-
- # Patch for v4l1 compat support
- sed -i -e "s/$ENV{SHELL} = \'\/bin\/sh\' if exists $ENV{SHELL};/$ENV{SHELL} = \'\/bin\/sh\' if exists $ENV{SHELL};\n$ENV{LD_PRELOAD} = \'\/usr\/lib\/libv4l\/v4l1compat.so\' ;/"\
- scripts/zmdc.pl.in || read
-
- # Patch for add more socket tries
- sed -i -e '/$max_socket_tries/ s/3/15/'\
- web/ajax/stream.php || read
-
- # Patch for wrong "suppported"
- sed -i -e 's/suppported/supported/'\
- src/zm_local_camera.cpp || read
-
- # Patch for type cast in linux-libre kernel 3.5
- sed -i -e 's/enum v4l2_buf_type type = v4l2_data.fmt.type;/enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;/'\
- src/zm_local_camera.cpp || read
-
- # Patch for drop custom perl install paths
- sed -i -e '/# Slight hack for non-standard perl install paths/,+10 d;
- s/^AC_SUBST(ZM_CONFIG,"$SYSCONFDIR\/zm.conf")/AC_SUBST(ZM_CONFIG,"$SYSCONFDIR\/zm.conf")\n\nEXTRA_PERL_LIB="# Include from system perl paths only"\nPERL_MM_PARMS="INSTALLDIRS=vendor"/'\
- configure.ac
-
- # Patch for support new ffmpeg
- patch -p1 < $srcdir/patch-ffmpeg-0.11.patch
-# sed -i -e 's/if ( av_open_input_file( \&mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )/if ( avformat_open_input( \&mFormatContext, mPath.c_str(), NULL, NULL ) !=0 )/;
-# s/if ( avcodec_open( mCodecContext, mCodec ) < 0 )/if ( avcodec_open2( mCodecContext, mCodec, NULL ) < 0 )/'\
-# src/zm_ffmpeg_camera.cpp
-# sed -i -e 's/if ( av_set_parameters(ofc, NULL) < 0 )/\/\*\n \* Removed in last ffmpeg\n \* if ( av_set_parameters(ofc, NULL) < 0 )/;
-# /Panic( "Invalid output format parameters" );/,+1 s/}/}\*/;
-# /if ( avio_open(&ofc->pb, filename, URL_WRONLY) < 0 )/ s/URL_WRONLY/AVIO_FLAG_WRITE/;
-# s/av_write_header(ofc);/avformat_write_header(ofc, NULL);/'\
-# src/zm_mpeg.cpp
- sed -i -e 's/avcodec_init/avcodec_open/'\
- configure{,.ac}
-
- # Patch for support ffmpeg with <libavutil/mathematics.h> and C library
- sed -i -e 's/^extern "C" {/extern "C" {\n#ifdef _STDINT_H\n#undef _STDINT_H\n#endif\n#include <stdint.h>/
- s/^#include <libavutil\/avutil.h>/#include <libavutil\/avutil.h>\n#include <libavutil\/mathematics.h>/'\
- src/zm_ffmpeg.h
- sed -i -e 's/^AM_CONFIG_HEADER(config.h)/AM_CONFIG_HEADER(config.h)\n\nAC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS])/;
- s/^AC_CHECK_HEADERS(mysql\/mysql.h,,AC_MSG_ERROR(zm requires MySQL headers - check that MySQL development packages are installed),)/AC_CHECK_HEADERS(mysql\/mysql.h,,AC_MSG_ERROR(zm requires MySQL headers - check that MySQL development packages are installed),)\nAC_LANG_PUSH([C])/;
- s/^AC_CHECK_HEADERS(libswscale\/swscale.h,,,)/AC_CHECK_HEADERS(libswscale\/swscale.h,,,)\nAC_LANG_POP([C])/'\
- configure.ac
-
- # Patch for wrong install run, tmp and log dir
- sed -i -e '/ install-data-hook/d;/install-data-hook:/d;/# Yes, you are correct. This is a HACK!/d;
- / ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )/d;
- / ( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; if test "$(ZM_RUNDIR)" != "\/var\/run"; then chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR); fi )/d;
- / ( if ! test -e $(ZM_TMPDIR); then mkdir -m 700 -p $(ZM_TMPDIR); fi; if test "$(ZM_TMPDIR)" != "\/tmp"; then chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR); fi )/d;
- / ( if ! test -e $(ZM_LOGDIR); then mkdir -p $(ZM_LOGDIR); fi; if test "$(ZM_LOGDIR)" != "\/var\/log"; then chown $(webuser):$(webgroup) $(ZM_LOGDIR); chmod u+w $(ZM_LOGDIR); fi )/,+1 d'\
- Makefile.{am,in}
-
- ./configure --prefix=/usr\
- --enable-crashtrace=no\
- --enable-debug=no\
- --enable-mmap=yes\
- --sysconfdir=/etc\
- --with-cgidir=/data/srv/httpd/cgi-bin\
- --with-extralibs='-L/usr/lib -L/usr/lib/mysql'\
- --with-ffmpeg=/usr\
- --with-libarch=lib\
- --with-mysql=/usr\
- --with-webdir=/data/srv/httpd/$pkgname\
- --with-webgroup=http\
- --with-webhost=localhost\
- --with-webuser=http
-
- make V=0
+ cd $srcdir/ZoneMinder-$pkgver
+
+ cmake -DCMAKE_INSTALL_PREFIX=/usr \
+ -DZM_CGIDIR=/data/srv/http/cgi-bin \
+ -DZM_WEBDIR=/data/srv/http/zoneminder \
+ -DZM_WEB_USER=http \
+ -DZM_CONTENTDIR=/var/cache/zoneminder \
+ -DZM_LOGDIR=/var/log/zoneminder \
+ -DZM_RUNDIR=/var/run/zm \
+ -DZM_TMPDIR=/var/tmp \
+ -DZM_SOCKDIR=/data/srv/zoneminder/socks/ .
+
+ make V=0
}
-
+
package() {
- cd $srcdir/ZoneMinder-$pkgver
-
- make DESTDIR=$pkgdir install
-
- mkdir -p $pkgdir/{etc/{httpd/conf/extra,rc.d},data/srv/httpd/{cgi-bin,$pkgname},usr/{lib/systemd/system,share/{license/$pkgname,$pkgname/db}},var/{cache/$pkgname,log/$pkgname}}
-
- chown -R http.http $pkgdir/{etc/zm.conf,var/{cache/$pkgname,log/$pkgname}}
- chmod 0700 $pkgdir/etc/zm.conf
-
- for i in events images temp; do
- mv $pkgdir/data/srv/httpd/$pkgname/$i $pkgdir/var/cache/$pkgname/$i
- ln -s /var/cache/$pkgname/$i $pkgdir/data/srv/httpd/$pkgname/$i
- chown -h http.http $pkgdir/data/srv/httpd/$pkgname/$i
- done
-
- ln -s /data/srv/httpd/cgi-bin $pkgdir/data/srv/httpd/$pkgname
- chown -h http.http $pkgdir/data/srv/httpd/{cgi-bin,$pkgname,$pkgname/cgi-bin}
-
- ln -s /usr/share/cambozola/cambozola.jar $pkgdir/data/srv/httpd/$pkgname
- mkdir -p $pkgdir/etc/lighttpd
-
- install -D -m 644 $srcdir/zm.include $pkgdir/etc/lighttpd/
- #sysctrl conf
- install -o root -g root -D -m 0755 $srcdir/zm.sysctrl.conf $startdir/pkg/etc/sysctl.d/zm.conf
- #gen_light_conf
- install -D -m0744 ${srcdir}/zm_gen_light.conf ${pkgdir}/etc/gen_light_conf.d/zoneminder.conf
-
- install -D -m 644 $srcdir/httpd-$pkgname.conf $pkgdir/etc/httpd/conf/extra
- install -D -m 644 $srcdir/$pkgname $pkgdir/etc/rc.d
- 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
+ cd $srcdir/ZoneMinder-$pkgver
+
+ DESTDIR=$pkgdir make install
+
+ # BEGIN CREATE_ZONEMINDER_DIRECTORIES
+ mkdir -p $pkgdir/var/run/zm
+ chown -v http.http $pkgdir/var/run/zm
+ mkdir -p $pkgdir/var/{cache/$pkgbase,log/$pkgbase}
+ mkdir -p $pkgdir/data/srv/zoneminder/socks
+ chown -Rv http.http $pkgdir/{etc/zm.conf,var/{cache/$pkgbase,log/$pkgbase}}
+ chown -Rv http.http $pkgdir/data/srv/zoneminder/socks
+ chmod 0700 $pkgdir/etc/zm.conf
+ # END CREATE_ZONEMINDER_DIRECTORIES
+
+ # Make content directories in /var/cache/zoneminder and link them
+ for i in events images temp; do
+ mkdir $pkgdir/var/cache/$pkgbase/$i
+ # chown -v http.http $pkgdir/var/cache/$pkgbase/$i
+ ln -s /var/cache/$pkgbase/$i $pkgdir/data/srv/http/$pkgbase/$i
+ chown -v --no-dereference http.http $pkgdir/data/srv/http/$pkgbase/$i
+ done
+
+ # Create a link to the Zoneminder cgi binaries
+ ln -sv /data/srv/http/cgi-bin $pkgdir/data/srv/http/$pkgbase
+
+ chown -h http.http $pkgdir/data/srv/http/{cgi-bin,$pkgbase,$pkgbase/cgi-bin}
+
+ # Link Cambozola
+ ln -s /usr/share/cambozola/cambozola.jar $pkgdir/data/srv/http/$pkgbase
+
+ # Install configuration files
+ mkdir -p $pkgdir/etc/httpd/conf/extra
+ install -D -m 644 $srcdir/httpd-$pkgbase.conf $pkgdir/etc/httpd/conf/extra
+ mkdir -p $pkgdir/usr/lib/systemd/system
+ install -D -m 644 $srcdir/$pkgbase.service $pkgdir/usr/lib/systemd/system
+ install -D -m 644 COPYING $pkgdir/usr/share/license/$pkgbase
+ install -D -m 644 db/zm*.sql $pkgdir/usr/share/$pkgbase/db
+
+ #LinHES stuff
+ #lighttpd zm include
+ install -D -m644 $srcdir/zm.include $pkgdir/etc/lighttpd/zm.include
+ #sysctrl conf - to set the shared mem
+ install -o root -g root -D -m0755 $srcdir/zm.sysctrl.conf $pkgdir/etc/sysctl.d/zm.conf
+ #gen_light_conf
+ install -D -m0744 ${srcdir}/zm_gen_light.conf $pkgdir/etc/gen_light_conf.d/zoneminder.conf
}
-md5sums=('eaefa14befd482154970541252aa1a39'
- '72380d8793a784ec24cb6809aea4a739'
- '034b61cda8849fc3001849e76ef26041'
- 'ca3fe00739707b9f92eaaa9034d4da2b'
- '81c8be870260142e2633eedf73c72040'
+md5sums=('b0317c6fe003de9a0c7c76078b0adc2b'
+ 'dcaa22b9030bc7b5b76568dbe8ea9eca'
+ 'bb801be691cbe1ed98f395b2ebe5c882'
'9d93f9b7b0a1384df533efde19ed3021'
'c528e75443ae421cb7f63e12350c692a'
'81cb12b36616a299ec808ac70a809ec2')
diff --git a/abs/core/zoneminder/__changelog b/abs/core/zoneminder/__changelog
index 5ebce4d..eb1e8ea 100644
--- a/abs/core/zoneminder/__changelog
+++ b/abs/core/zoneminder/__changelog
@@ -1,17 +1,16 @@
-Change cgidir and webdir:
- /data/srv/
+PKGBUILD: remove apache
+PKGBUILD: add lighttpd
+PKGBUILD: remove php-apache
+PKGBUILD: change mariadb to mysql
+PKGBUILD: change all /srv/ to /data/srv/ - cgidir webdir socks
+PKGBUILD: add zm.include for lighttpd
+PKGBUILD: add zm.sysctrl.conf to set the shared mem
+PKGBUILD: add zm_gen_light.conf
--
-added zm.include for lighttpd
-added zm.sysctrl.conf to set the shared mem
-added zm_gen_light.conf
---
-run file
-
---
-
Install file
Removed modifications of php.ini
Added remove/add of zm.include in post install/remove
added install_db
add http to video group
gen_light_conf.py
+--
diff --git a/abs/core/zoneminder/gen_light_zm.conf b/abs/core/zoneminder/gen_light_zm.conf
deleted file mode 100644
index 3716bb0..0000000
--- a/abs/core/zoneminder/gen_light_zm.conf
+++ /dev/null
@@ -1 +0,0 @@
-include "/etc/lighttpd/zm.include"
diff --git a/abs/core/zoneminder/httpd-zoneminder.conf b/abs/core/zoneminder/httpd-zoneminder.conf
index aeb089b..cdb7722 100644
--- a/abs/core/zoneminder/httpd-zoneminder.conf
+++ b/abs/core/zoneminder/httpd-zoneminder.conf
@@ -3,7 +3,7 @@
Alias /zm "/srv/http/zoneminder"
<Directory "/srv/http/zoneminder">
- Options -Indexes MultiViews FollowSymLinks
+ Options -Indexes +MultiViews +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
@@ -14,7 +14,7 @@ Alias /zm "/srv/http/zoneminder"
ScriptAlias /cgi-bin "/srv/http/cgi-bin"
<Directory "/srv/http/cgi-bin">
AllowOverride None
- Options ExecCGI FollowSymLinks
+ Options +ExecCGI +FollowSymLinks
Order allow,deny
Allow from all
</Directory>
diff --git a/abs/core/zoneminder/patch-ffmpeg-0.11.patch b/abs/core/zoneminder/patch-ffmpeg-0.11.patch
deleted file mode 100644
index ac56e4c..0000000
--- a/abs/core/zoneminder/patch-ffmpeg-0.11.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp
-index 42927f6..61df606 100644
---- a/src/zm_ffmpeg_camera.cpp
-+++ b/src/zm_ffmpeg_camera.cpp
-@@ -91,7 +91,7 @@ int FfmpegCamera::PrimeCapture()
- Info( "Priming capture from %s", mPath.c_str() );
-
- // Open the input, not necessarily a file
-- if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
-+ if ( avformat_open_input( &mFormatContext, mPath.c_str(), NULL, NULL ) !=0 )
- Fatal( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
-
- // Locate stream info from input
-@@ -122,7 +122,7 @@ int FfmpegCamera::PrimeCapture()
- Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
-
- // Open the codec
-- if ( avcodec_open( mCodecContext, mCodec ) < 0 )
-+ if ( avcodec_open2( mCodecContext, mCodec, NULL ) < 0 )
- Fatal( "Unable to open codec for video stream from %s", mPath.c_str() );
-
- // Allocate space for the native video frame
-
-diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp
-index f5de2a4..d614346 100644
---- a/src/zm_mpeg.cpp
-+++ b/src/zm_mpeg.cpp
-@@ -130,10 +130,12 @@ void VideoStream::SetParameters()
- {
- /* set the output parameters (must be done even if no
- parameters). */
-- if ( av_set_parameters(ofc, NULL) < 0 )
-+ /*
-+ * Removed in last ffmpeg
-+ * if ( av_set_parameters(ofc, NULL) < 0 )
- {
- Panic( "Invalid output format parameters" );
-- }
-+ }*/
- //dump_format(ofc, 0, filename, 1);
- }
-
-@@ -222,7 +224,7 @@ void VideoStream::OpenStream()
- if ( !(of->flags & AVFMT_NOFILE) )
- {
- #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
-- if ( avio_open(&ofc->pb, filename, URL_WRONLY) < 0 )
-+ if ( avio_open(&ofc->pb, filename, AVIO_FLAG_WRITE) < 0 )
- #else
- if ( url_fopen(&ofc->pb, filename, URL_WRONLY) < 0 )
- #endif
-@@ -241,7 +243,7 @@ void VideoStream::OpenStream()
- }
-
- /* write the stream header, if any */
-- av_write_header(ofc);
-+ avformat_write_header(ofc, NULL);
- }
-
- VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height )
diff --git a/abs/core/zoneminder/zoneminder b/abs/core/zoneminder/zoneminder
deleted file mode 100644
index c4cbf4d..0000000
--- a/abs/core/zoneminder/zoneminder
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-
-daemon_name=zm
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-case "$1" in
- start)
- stat_busy "Starting Zoneminder"
- /usr/bin/zmfix -a
- if /usr/bin/zmpkg.pl start >/dev/null ; then
- add_daemon $daemon_name
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
-
- stop)
- stat_busy "Stopping Zoneminder"
- if /usr/bin/zmpkg.pl stop >/dev/null ; then
- rm_daemon $daemon_name
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
-
- reload)
- stat_busy "Reloading Zoneminder"
- if /usr/bin/zmpkg.pl graceful >/dev/null ; then
- add_daemon $daemon_name
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
-
- restart)
- stat_busy "Restarting Zoneminder"
- if /usr/bin/zmpkg.pl restart >/dev/null ; then
- add_daemon $daemon_name
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
-
- status)
- stat_busy "Checking Zoneminder status";
- ck_status $daemon_name
- ;;
-
- *)
- echo "usage: $0 {start|stop|reload|restart|status}"
-esac
-
-exit 0
diff --git a/abs/core/zoneminder/zoneminder.install b/abs/core/zoneminder/zoneminder.install
index bf5cd99..0a1f557 100644
--- a/abs/core/zoneminder/zoneminder.install
+++ b/abs/core/zoneminder/zoneminder.install
@@ -1,86 +1,178 @@
-
-install_db() {
- . /etc/systemconfig
- if [ $SystemType = Master_backend -o $SystemType = Standalone ]
- then
- mysql -e "use zm" > /dev/null
- rc=$?
- if [ $rc = 1 ]
- then
- echo "Installing zoneminder database zm"
- cat /usr/share/zoneminder/db/zm_create.sql | mysql
- echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql
- fi
- else
- echo "Will only init the database for StandAlone or Master_backend LinHES systems"
- fi
- }
-
pre_install() {
- set -e
- abort=false
- if [ -L /srv/http/zoneminder/events ]; then
- l=$(readlink /srv/http/zoneminder/events)
- if [ $l != /var/cache/zoneminder/events ]; then
- abort=true
+ set -e
+ abort=false
+ if [ -L /srv/http/zoneminder/events ]; then
+ l=$(readlink /srv/http/zoneminder/events)
+ if [ $l != /var/cache/zoneminder/events ]; then
+ abort=true
+ fi
fi
- fi
- if [ -L /srv/http/zoneminder/images ]; then
- l=$(readlink /srv/http/zoneminder/images)
- if [ $l != /var/cache/zoneminder/images ]; then
- abort=true
+ if [ -L /srv/http/zoneminder/images ]; then
+ l=$(readlink /srv/http/zoneminder/images)
+ if [ $l != /var/cache/zoneminder/images ]; then
+ abort=true
+ fi
fi
- fi
- if [ $abort = true ]; then
- cat >&2 << EOF
+ if [ $abort = true ]; then
+ cat >&2 << EOF
Aborting installation of zoneminder due to non-default symlinks in
/srv/http/zoneminder for the images and/or events directory, which could
result in loss of data. Please move your data in each of these directories to
/var/cache/zoneminder before installing zoneminder from the package.
EOF
- exit 1
- fi
- exit 0
+ exit 1
+ fi
+ exit 0
}
post_install() {
- if [[ -d /var/log/zoneminder ]]; then
- chmod 0755 /var/log/zoneminder
- chown http.http /var/log/zoneminder
- else
- mkdir -m 0755 /var/log/zoneminder
- chown http.http /var/log/zoneminder
- fi
- if [[ -d /tmp/zoneminder ]]; then
- chmod 0700 /tmp/zoneminder
- chown http.http /tmp/zoneminder
- else
- mkdir -m 0700 /tmp/zoneminder
- chown http.http /tmp/zoneminder
- fi
-#---
- usermod -G video http
- install_db
- gen_light_include.py
- /sbin/sv hup /service/lighttpd
-#---
+ if [[ -d /var/log/zoneminder ]]; then
+ chmod 0755 /var/log/zoneminder
+ chown http.http /var/log/zoneminder
+ else
+ mkdir -m 0755 /var/log/zoneminder
+ chown http.http /var/log/zoneminder
+ fi
+ if [[ -d /tmp/zm ]]; then
+ chmod 0700 /tmp/zm
+ chown http.http /tmp/zm
+ else
+ mkdir -m 0700 /tmp/zm
+ chown http.http /tmp/zm
+ fi
+
+ # edit /etc/php.ini for Zoneminder
+ sed -e '
+ # Enable these libraries by removing the leading comment character
+ \|^;extension=mysql.so$| s|^;||;
+ \|^;extension=mysqli.so$| s|^;||;
+ \|^;extension=pdo_mysql.so$| s|^;||;
+ \|^;extension=gd.so$| s|^;||;
+ \|^;extension=gettext.so$| s|^;||;
+ \|^;extension=mcrypt.so$| s|^;||;
+ \|^;extension=session.so$| s|^;||;
+ \|^;extension=sockets.so$| s|^;||;
+ \|^;extension=openssl.so$| s|^;||;
+ \|^;extension=ftp.so$| s|^;||;
+ \|^;extension=zip.so$| s|^;||;
+
+ # Add zoneminder paths to open_basedir
+ s|^open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/$|&:/etc:/srv/http/zoneminder/:/var/cache/zoneminder/|;
+ ' /etc/php/php.ini > /etc/php/php.ini.zoneminder
+
+ # edit /etc/httpd/conf/httpd.conf for Zoneminder
+ sed -e '
+ # Use mod_mpm_prefork instead of mod_mpm_event.so (FS#39218).
+ s|^LoadModule mpm_event_module modules/mod_mpm_event.so$|#&\nLoadModule mpm_prefork_module modules/mod_mpm_prefork.so|;
+
+ # Zoneminder requires cgi
+ \|^#LoadModule cgi_module modules/mod_cgi.so$| s|#||;
+
+ # libphp5
+ \|^LoadModule php5_module modules/libphp5.so$|d;
+ s|^#*LoadModule rewrite_module modules/mod_rewrite.so$|&\nLoadModule php5_module modules/libphp5.so|;
+ \|^Include /etc/httpd/conf/extra/php5_module.conf|d;
+ s|^Include conf/extra/httpd-default.conf$|&\nInclude /etc/httpd/conf/extra/php5_module.conf|;
+
+ # Include httpd-zoneminder.conf
+ \|^Include /etc/httpd/conf/extra/httpd-zoneminder.conf$|d;
+ s|^# Server-pool management (MPM specific)$|\nInclude /etc/httpd/conf/extra/httpd-zoneminder.conf\n&|;
+ ' /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf.zoneminder
+
+ cat << EOF
+Note for mysql:
+==> To run Zoneminder, you must install the database running mysql service (as root):
+==> "rc.d start mysqld" (in initscripts) or "systemctl start mysqld.service" (in systemd)
+==> and add Zoneminder database typing (with passsword):
+==> "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 passsword):
+==> "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"
+
+Note for php:
+==> You must uncomment that line in /etc/php/php.ini:
+==> "extension=mysql.so"
+==> check and make sure these are uncommented:
+==> "extension=gd.so"
+==> "extension=gettext.so"
+==> "extension=mcrypt.so"
+==> "extension=mysqli.so"
+==> "extension=session.so"
+==> "extension=sockets.so"
+==> "extension=openssl.so"
+==> "extension=ftp.so"
+==> "extension=zip.so"
+==> check and add to open_basedir "/etc" and
+==> "/srv/http/zoneminder" like so
+==> "open_basedir = /home:/tmp:/usr/share/pear:/etc:/srv/http/zoneminder"
+==> and set your timezone in php.ini:
+==> "date.timezone = <your_country>/<your_city>"
+
+Note for apache:
+==> You must 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
- gen_light_include.py
- /sbin/sv hup /service/lighttpd
+ post_install
+ /usr/bin/zmupdate.pl -f >/dev/null
}
post_remove() {
- if [[ -d /tmp/zoneminder ]]; then
- rm -vr /tmp/zoneminder
- fi
+ 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
-#--
- gen_light_include.py
- /sbin/sv hup /service/lighttpd
-#--
+ 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=session.so"
+==> "extension=sockets.so"
+==> "date.timezone = <my_country>/<my_city>"
+
+==> Edit /etc/php/php.ini and remove "/etc" and "/srv/http/zoneminder"
+==> in the "open_basedir".
+
+==> Remove log files and "zonemider" directory in "/var/log/zoneminder".
+
+==> Backup and remove "events", "images" and "temp" dirs in "/var/cache/zoneminder".
+EOF
}
diff --git a/abs/core/zoneminder/zoneminder.service b/abs/core/zoneminder/zoneminder.service
index 05cae6f..1314521 100644
--- a/abs/core/zoneminder/zoneminder.service
+++ b/abs/core/zoneminder/zoneminder.service
@@ -1,13 +1,18 @@
+# ZoneMinder systemd unit file
+# This file is intended to work with all Linux distributions
+
[Unit]
-Description=Capture, analyse, record and monitor video security cameras
-After=network.target remote-fs.target
-Required=mysqld.service
+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
-ExecRestart=/usr/bin/zmpkg.pl restart
-ExecStop=/usr/bin/zmpkg.pl stop
+ExecReload=/usr/bin/zmpkg.pl restart
+ExecStop=/bin/bash -c '[[ "$(/usr/bin/pgrep zmdc.pl)" > 0 ]] && /usr/bin/zmpkg.pl stop'
+PIDFile="/var/run/zm/zm.pid"
[Install]
WantedBy=multi-user.target