diff options
Diffstat (limited to 'pcr')
-rw-r--r-- | pcr/zoneminder/PKGBUILD | 179 | ||||
-rw-r--r-- | pcr/zoneminder/httpd-zm.conf | 18 | ||||
-rw-r--r-- | pcr/zoneminder/patch-ffmpeg-0.11.patch | 12 | ||||
-rw-r--r-- | pcr/zoneminder/zm.rc.d | 221 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder-1.25.0-kernel35.patch | 4 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder.install | 121 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder.service | 14 |
7 files changed, 258 insertions, 311 deletions
diff --git a/pcr/zoneminder/PKGBUILD b/pcr/zoneminder/PKGBUILD index 334d32325..c53cc2695 100644 --- a/pcr/zoneminder/PKGBUILD +++ b/pcr/zoneminder/PKGBUILD @@ -4,113 +4,110 @@ # Maintainer (Parabola): Márcio Silva <coadde@lavabit.com> # Maintainer (Parabola): André Silva <emulatorman@lavabit.com> +# based of debian squeeze package + pkgname=zoneminder pkgver=1.25.0 -pkgrel=14 -pkgdesc="Capture, analyse, record and monitor video security cameras" -arch=('i686' 'x86_64' 'mips64el') -url="http://www.zoneminder.com" -license=('GPL') -depends=('cambozola' 'apache' 'php' 'php-gd' 'php-mcrypt' 'mysql' 'pcre' 'openssl' 'ffmpeg' 'perl-libwww' 'perl-date-manip' 'perl-unicode-map' 'perl-dbi' 'perl-dbd-mysql' 'perl-io-stringy' 'perl-mime-lite' 'perl-timedate' 'perl-x10' 'perl-time-modules' 'perl-net-smtp-ssl' 'perl-sys-mmap' 'perl-net-sftp-foreign' 'perl-mime-tools' 'perl-io-tty' 'libv4l' 'libjpeg' 'gnutls' 'php-apache') -makedepends=() -install=zoneminder.install -source=("http://www.zoneminder.com/downloads/ZoneMinder-${pkgver}.tar.gz" - zm.rc.d - Controls_Orbit.sql - zminit.arch - customdb - httpd-zm.conf - zmeventbackup - patch-ffmpeg-0.11.patch - patch-libavcodec-detection.patch - zoneminder-1.25.0-kernel35.patch - arm-context.patch) - -md5sums=('eaefa14befd482154970541252aa1a39' - '9fb81f81b056c18be6eef3f1c8e0dd6d' - '5033bc098bf497c8aed1fc1b3c9c5f9c' - 'f9720872736f26d17bc49d8725b75ae4' - '942f6641c744ffe7d64846a5c34d84f1' - 'e63262d1417105ae24c7a03d98b2c64c' - '1a6d7c43af79c786b27cc88f7ba7ed3e' - 'b872dd86926ab00c5d4733e7e38eaa9c' - '94bf5d95fe5429f7df458ddfbabf0c12' - '88bd124dfb841320cecb0a757b2a78c1' - 'b28c8eb392a7e7b6ef665817d7fe61f4') - +pkgrel=15 +pkgdesc='Capture, analyse, record and monitor video security cameras' +arch=(i686 x86_64 mips64el) +backup=(etc/zm.conf etc/httpd/conf/extra/httpd-zm.conf) +url=http://www.$pkgname.com +license=(GPL) +depends=( + apache cambozola ffmpeg gnutls mysql perl-archive-zip perl-date-manip perl-dbd-mysql perl-dbi perl-libwww perl-mime-lite + perl-mime-tools perl-net-sftp-foreign perl-sys-mmap perl-time-modules perl-x10 php php-apache php-gd php-mcrypt +) +makedepends=(netpbm) +install=$pkgname.install +source=( + http://www.$pkgname.com/downloads/ZoneMinder-$pkgver.tar.gz + patch-ffmpeg-0.11.patch + patch-libavcodec-detection.patch + $pkgname-1.25.0-kernel35.patch + httpd-zm.conf + zm.rc.d + $pkgname.service +) +md5sums=( + eaefa14befd482154970541252aa1a39 + 81c8be870260142e2633eedf73c72040 + 94bf5d95fe5429f7df458ddfbabf0c12 + 48a3c48394e18bf072f7b32730db18df + 831e3538facff18e27d402e36dbd6b8d + 034b61cda8849fc3001849e76ef26041 + 7487cc72ead82aea0bc78f2e4106ae1a +) build() { - cd "$srcdir/ZoneMinder-$pkgver" + cd $srcdir/ZoneMinder-$pkgver + + export CPPFLAGS=-D__STDC_CONSTANT_MACROS \ + ZM_SSL_LIB=gnutls # Patch for GCC 4.7.x sed -i -e '1 s/^/#include <unistd.h>\n/;' src/zm_logger.cpp sed -i -e '1 s/^/#include <unistd.h>\n/;' src/zm_thread.h - # Patch for build/upgrade path - sed -i -e 's#ZM_PATH_BUILD=@PATH_BUILD@#ZM_PATH_BUILD=/srv/zoneminder/upgrade\nZM_PATH_UPDATE=/srv/zoneminder/upgrade#' zm.conf.in - # Patch for support new ffmpeg - patch -p1 < ../patch-ffmpeg-0.11.patch + patch -p1 < $srcdir/patch-ffmpeg-0.11.patch # Patch for correct libavcodec detection - patch -p0 < ../patch-libavcodec-detection.patch + patch -p0 < $srcdir/patch-libavcodec-detection.patch # Patch for type cast in kernel3.5 - patch -p0 < ../zoneminder-1.25.0-kernel35.patch - - # Patch for ARM - if test "$CARCH" == arm; then - patch -p0 < ../arm-context.patch - fi - - # Add some more configs into DB - cat ../Controls_Orbit.sql >> db/zm_create.sql.in + patch -p0 < $srcdir/$pkgname-1.25.0-kernel35.patch ./configure --prefix=/usr \ + --build \ + --enable-crashtrace=yes \ + --enable-debug=yes \ + --enable-mmap=yes \ + --mandir=/usr/share/man \ --sysconfdir=/etc \ - --with-webuser=http \ + --with-cgidir=/usr/lib/$pkgname/cgi-bin \ + --with-ffmpeg=/usr \ + --with-libarch=lib \ + --with-mysql=/usr \ + --with-webdir=/usr/share/$pkgname \ --with-webgroup=http \ - --with-mysql=/usr \ - --with-webdir=/srv/zoneminder/www \ - --with-cgidir=/srv/zoneminder/cgi-bin \ - --bindir=/srv/zoneminder/bin \ - ZM_SSL_LIB=openssl \ - CPPFLAGS=-D__STDC_CONSTANT_MACROS - - # chown line mucks everything up, we'll chown it in the install script - sed -i '/chown/d' Makefile - - # modify hard-coded paths - sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmdbrestore.in - sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmlogrotate.conf.in - sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmdbbackup.in - - # Build it! - make || return 1 - make DESTDIR="$pkgdir" ZM_RUNDIR="$pkgdir/var/run" ZM_TMPDIR="$pkgdir/tmp" ZM_LOGDIR="$pkgdir/var/log" install || return 1 - - install -D -m 700 $startdir/src/zminit.arch $startdir/pkg/srv/zoneminder/bin/zminit - install -D -m 755 $startdir/src/zm.rc.d $startdir/pkg/etc/rc.d/zm - install -D -m 700 scripts/zmdbbackup $startdir/pkg/srv/zoneminder/bin/zmdbbackup - install -D -m 700 scripts/zmdbbackup $startdir/pkg/srv/zoneminder/bin/zmdbbackup - install -D -m 700 scripts/zmdbrestore $startdir/pkg/srv/zoneminder/bin/zmdbrestore - install -D -m 700 scripts/zmeventdump $startdir/pkg/srv/zoneminder/bin/zmeventdump - install -D -m 700 scripts/zmlogrotate.conf $startdir/pkg/etc/logrotate.d/zm - install -D -m 700 $startdir/src/zmeventbackup $startdir/pkg/etc/cron.hourly/zmeventbackup - - mkdir -p $startdir/pkg/etc/httpd/conf/extra/ - install -m 644 $startdir/src/httpd-zm.conf $startdir/pkg/etc/httpd/conf/extra/httpd-zm.conf - - install -D -m 700 $startdir/src/customdb $startdir/pkg/srv/zoneminder/upgrade/customdb - install -D db/zm*.sql $startdir/pkg/srv/zoneminder/upgrade/ - - mkdir -p $startdir/pkg/var/run/zm - - ### remove special files - find $startdir/pkg/ -name "perllocal.pod" \ - -o -name ".packlist" \ - -o -name "*.bs" \ - |xargs -i rm -f {} - + --with-webuser=http + make V=0 } -# vim:set ft=sh ts=2 sw=2 et: +package() { + cd $srcdir/ZoneMinder-$pkgver + + make DESTDIR=$pkgdir \ + ZM_LOGDIR=$pkgdir/var/log/zm \ + ZM_RUNDIR=$pkgdir/run \ + ZM_TMPDIR=$pkgdir/tmp \ + install + + rmdir $pkgdir/run + rmdir $pkgdir/tmp + + mkdir -p $pkgdir/etc/httpd/conf/extra + mkdir -p $pkgdir/etc/rc.d + mkdir -p $pkgdir/usr/lib/systemd/system + mkdir -p $pkgdir/usr/share/license/$pkgname + mkdir -p $pkgdir/usr/share/$pkgname/db + mkdir -p $pkgdir/var/cache/$pkgname + + for i in events images temp; do + mv $pkgdir/usr/share/$pkgname/$i $pkgdir/var/cache/$pkgname/$i + ln -s /var/cache/$pkgname/$i $pkgdir/usr/share/$pkgname/$i + done + + ln -s /usr/lib/$pkgname/cgi-bin $pkgdir/usr/share/$pkgname + ln -s /usr/share/cambozola/cambozola.jar $pkgdir/usr/share/$pkgname + + chown http.http $pkgdir/etc/zm.conf + chown -R http.http $pkgdir/var/cache/$pkgname + chown http.http $pkgdir/var/log/zm + + install -D -m 644 $srcdir/httpd-zm.conf $pkgdir/etc/httpd/conf/extra + install -D -m 644 $srcdir/zm.rc.d $pkgdir/etc/rc.d/zm + 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/pcr/zoneminder/httpd-zm.conf b/pcr/zoneminder/httpd-zm.conf index ad24cbbe4..e48ea9fc6 100644 --- a/pcr/zoneminder/httpd-zm.conf +++ b/pcr/zoneminder/httpd-zm.conf @@ -1,16 +1,18 @@ # /etc/httpd/conf/extra/httpd-zm.conf # Config for zoneminder web app -Alias /zm "/srv/zoneminder/www" -<Directory "/srv/zoneminder/www"> - Options -Indexes MultiViews FollowSymLinks - AllowOverride All - Order allow,deny - Allow from all +Alias /zm "/usr/share/zoneminder" +<Directory "/usr/share/zoneminder"> + Options -Indexes MultiViews FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + # The code unfortunately uses short tags in many places + php_value short_open_tag 1 </Directory> -ScriptAlias /cgi-bin "/srv/zoneminder/cgi-bin" -<Directory "/srv/zoneminder/cgi-bin"> +ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin" +<Directory "/usr/lib/zoneminder/cgi-bin"> AllowOverride All Options ExecCGI Order allow,deny diff --git a/pcr/zoneminder/patch-ffmpeg-0.11.patch b/pcr/zoneminder/patch-ffmpeg-0.11.patch index 8356fff83..ac56e4c69 100644 --- a/pcr/zoneminder/patch-ffmpeg-0.11.patch +++ b/pcr/zoneminder/patch-ffmpeg-0.11.patch @@ -2,7 +2,7 @@ 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
-@@ -108,7 +108,7 @@ int FfmpegCamera::PrimeCapture()
+@@ -91,7 +91,7 @@ int FfmpegCamera::PrimeCapture()
Info( "Priming capture from %s", mPath.c_str() );
// Open the input, not necessarily a file
@@ -11,7 +11,7 @@ index 42927f6..61df606 100644 Fatal( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
// Locate stream info from input
-@@ -139,7 +139,7 @@ int FfmpegCamera::PrimeCapture()
+@@ -122,7 +122,7 @@ int FfmpegCamera::PrimeCapture()
Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
// Open the codec
@@ -25,7 +25,7 @@ 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
-@@ -167,10 +167,12 @@ void VideoStream::SetParameters()
+@@ -130,10 +130,12 @@ void VideoStream::SetParameters()
{
/* set the output parameters (must be done even if no
parameters). */
@@ -40,7 +40,7 @@ index f5de2a4..d614346 100644 //dump_format(ofc, 0, filename, 1);
}
-@@ -259,7 +261,7 @@ void VideoStream::OpenStream()
+@@ -222,7 +224,7 @@ void VideoStream::OpenStream()
if ( !(of->flags & AVFMT_NOFILE) )
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
@@ -49,7 +49,7 @@ index f5de2a4..d614346 100644 #else
if ( url_fopen(&ofc->pb, filename, URL_WRONLY) < 0 )
#endif
-@@ -278,7 +280,7 @@ void VideoStream::OpenStream()
+@@ -241,7 +243,7 @@ void VideoStream::OpenStream()
}
/* write the stream header, if any */
@@ -57,4 +57,4 @@ index f5de2a4..d614346 100644 + 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 )
\ No newline at end of file + VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height )
diff --git a/pcr/zoneminder/zm.rc.d b/pcr/zoneminder/zm.rc.d index 99a1f1f22..c4cbf4d3f 100644 --- a/pcr/zoneminder/zm.rc.d +++ b/pcr/zoneminder/zm.rc.d @@ -1,172 +1,63 @@ #!/bin/bash -# Source function library. +daemon_name=zm + . /etc/rc.conf . /etc/rc.d/functions -prog=ZoneMinder -ZM_VERSION="1.25.0" -ZM_PATH_BIN="/srv/zoneminder/bin" -ZM_CONFIG="/etc/zm.conf" -command="$ZM_PATH_BIN/zmpkg.pl" - -loadconf() -{ - if [ -f $ZM_CONFIG ]; then - . $ZM_CONFIG - else - echo "ERROR: $ZM_CONFIG not found. -" - return 1 - fi -} - -# Check for old config and update if needed -checkcfg() -{ - # Check config - if [ "$ZM_DB_HOST" = "" -o "$ZM_DB_NAME" = "" -o "$ZM_DB_USER" = "" -o "$ZM_DB_PASS" = "" ]; then - echo "In $ZM_CONFIG there should not be null values. -" - return 1 - loadconf - fi -} - -checkdb() -{ - # Check database exisits and version - GetVer="select Value from Config where Name='ZM_DYN_DB_VERSION'" - OLD_VERSION=`echo $GetVer | mysql -B -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'` - if [ "$OLD_VERSION" = "" ]; then - GetVer="select Value from Config where Name='ZM_DYN_CURR_VERSION'" - OLD_VERSION=`echo $GetVer | mysql -B -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'` - if [ "$OLD_VERSION" = "" ]; then - echo "You must run $ZM_PATH_BIN/zminit manually -" - return 1 - fi - fi - RETVAL=$? - - if [ $RETVAL != 0 ]; then - tbls=`mysql -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS -s -e 'show tables' $ZM_DB_NAME` - RETVAL=$? - if [ $RETVAL = 0 ]; then - echo "Initialize $prog database: -" - echo tbls | grep Config >/dev/null 2>&1 - RETVAL=$? - if [ $RETVAL != 0 ]; then - mysql -B -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME < $ZM_PATH_UPDATE/zm_create.sql - RETVAL=$? - [ $RETVAL = 0 ] && stat_done - [ $RETVAL != 0 ] && stat_fail - echo - return $RETVAL - fi - ( cd $ZM_PATH_UPDATE; perl $ZM_PATH_BIN/zmupdate.pl -f ) - RETVAL=$? - [ $RETVAL = 0 ] && stat_done - [ $RETVAL != 0 ] && stat_fail - echo - return $RETVAL - else - echo "No access to ZoneMinder database. -Run $ZM_PATH_BIN/zminit manually. -" - return $RETVAL - fi - else - [ "$ZM_VERSION" = "$OLD_VERSION" ] && return 0 - echo "Upgrade %s database: " "$prog" - $ZM_PATH_BIN/zmupdate.pl --version=$OLD_VERSION --noi && ( cd $ZM_PATH_UPDATE; perl $ZM_PATH_BIN/zmupdate.pl -f ) - RETVAL=$? - [ $RETVAL = 0 ] && stat_done - [ $RETVAL != 0 ] && stat_fail - echo - return $RETVAL - fi -} - -start() -{ - loadconf || return $? - checkcfg || return $? - checkdb || return $? - stat_busy "Starting $prog" - [ -d /var/run/zm ] || mkdir -m 774 /var/run/zm - chown -R $ZM_WEB_USER:$ZM_WEB_GROUP /var/run/zm - GetPath="select Value from Config where Name='ZM_PATH_SOCKS'" - ZM_PATH_SOCK=`echo $GetPath | mysql -B -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'` - [ -d $ZM_PATH_SOCK ] || mkdir -m 774 -p $ZM_PATH_SOCK - sudo -u $ZM_WEB_USER test -O $ZM_PATH_SOCK \ - || chown -R $ZM_WEB_USER:$ZM_WEB_GROUP $ZM_PATH_SOCK - # Setup the log dir - [ -d /var/log/zm ] || mkdir /var/log/zm - for logs in zmaudit.log zmdc.log zmfilter.log zmpkg.log zmupdate.log zmwatch.log; do - touch /var/log/zm/$logs - done - chown -R $ZM_WEB_USER:$ZM_WEB_GROUP /var/log/zm - $command start - RETVAL=$? - [ $RETVAL = 0 ] && stat_done && add_daemon zm - [ $RETVAL != 0 ] && stat_fail - #[ $RETVAL = 0 ] && touch /var/lock/subsys/zm - return $RETVAL -} - -stop() -{ - stat_busy "Stopping $prog" - $command stop - RETVAL=$? - [ $RETVAL = 0 ] && stat_done && rm_daemon zm - [ $RETVAL != 0 ] && stat_fail - #[ $RETVAL = 0 ] && rm -f /var/lock/subsys/zm -} - -status() -{ - result=`$command status` - if [ "$result" = "running" ]; then - echo "ZoneMinder is running -" - RETVAL=0 - else - echo "ZoneMinder is stopped -" - RETVAL=1 - fi -} - case "$1" in - 'start') - start - ;; - 'stop') - stop - ;; - 'restart') - stop - start - ;; - 'condrestart') - loadconf - checkcfg - result=`$ZM_PATH_BIN/zmdc.pl check` - if [ "$result" = "running" ]; then - $ZM_PATH_BIN/zmdc.pl shutdown > /dev/null - start - fi - ;; - 'status') - status - ;; - *) - echo "Usage: zm { start | stop | restart | condrestart | status } -" - RETVAL=1 - ;; + 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 $RETVAL + +exit 0 diff --git a/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch b/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch index 51bc1288d..9939dc5c3 100644 --- a/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch +++ b/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch @@ -1,7 +1,7 @@ diff -up ./src/zm_local_camera.cpp.kernel35 ./src/zm_local_camera.cpp --- ./src/zm_local_camera.cpp.kernel35 2012-07-16 15:01:22.182614878 -0500 +++ ./src/zm_local_camera.cpp 2012-07-16 15:02:16.491941730 -0500 -@@ -740,7 +740,7 @@ void LocalCamera::Terminate() +@@ -739,7 +739,7 @@ void LocalCamera::Terminate() { Debug( 3, "Terminating video stream" ); //enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -10,7 +10,7 @@ diff -up ./src/zm_local_camera.cpp.kernel35 ./src/zm_local_camera.cpp if ( vidioctl( vid_fd, VIDIOC_STREAMOFF, &type ) < 0 ) Error( "Failed to stop capture stream: %s", strerror(errno) ); -@@ -1520,7 +1520,7 @@ int LocalCamera::PrimeCapture() +@@ -1519,7 +1519,7 @@ int LocalCamera::PrimeCapture() Debug( 3, "Starting video stream" ); //enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install index be449a5ca..3ade5355e 100644 --- a/pcr/zoneminder/zoneminder.install +++ b/pcr/zoneminder/zoneminder.install @@ -1,57 +1,100 @@ -# zoneminder.install +pre_install() { + set -e + abort=false + if [ -L /usr/share/zoneminder/events ]; then + l=$(readlink /usr/share/zoneminder/events) + if [ $l != /var/cache/zoneminder/events ]; then + abort=true + fi + fi + if [ -L /usr/share/zoneminder/images ]; then + l=$(readlink /usr/share/zoneminder/images ) + if [ $l != /var/cache/zoneminder/images ]; then + abort=true + fi + fi + if [ $abort = true ]; then + cat >&2 << EOF +Aborting installation of zoneminder due to non-default symlinks in +/usr/share/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 +} -## arg 1: the new package version post_install() { - ln -s /usr/share/cambozola/cambozola.jar /srv/zoneminder/www/ - chown -R http.http /srv/zoneminder - chown http.http /etc/zm.conf - mkdir /srv/zoneminder/backup - mkdir /srv/zoneminder/socks + mkdir /usr/share/zoneminder/backup + mkdir /usr/share/zoneminder/socks cat << EOF Note: -==> To initialize the ZoneMinder database run (as root) -==> /srv/zoneminder/bin/zminit -EOF +==> 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: +==> 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" - cat << EOF -==> Check /etc/php/php.ini and make sure these are uncommented -==> extension=gd.so -==> extension=gettext.so -==> extension=mcrypt.so -==> extension=mysql.so -==> extension=mysqli.so -==> extension=session.so -==> extension=sockets.so -EOF - cat << EOF -==> Check /etc/php/php.ini and make sure short_open_tag = On -EOF +Note: +==> 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" +==> Check /etc/php/php.ini and make sure short_open_tag = On +==> or ZoneMinder will not work. - cat /etc/php/php.ini |grep "^open_basedir.*/etc/" | \ -grep "/srv/zoneminder/www">/dev/null || cat << EOF -==> You must edit /etc/php/php.ini and add to open_basedir "/etc/" and -==> "/srv/zoneminder/" like so -==> open_basedir = /home/:/tmp/:/usr/share/pear/:/etc/:/srv/zoneminder/ +==> You must edit /etc/php/php.ini and add to open_basedir "/etc" and +==> "/usr/share/zoneminder" like so +==> open_basedir = /home:/tmp:/usr/share/pear:/etc:/usr/share/zoneminder ==> Otherwise ZoneMinder will be unable to read /etc/zm.conf ==> or display its own web directory -EOF - cat << EOF Note: -==> You must edit /etc/httpd/conf/httpd.conf and uncomment/add the line +==> You must edit /etc/httpd/conf/httpd.conf and add the line: ==> LoadModule php5_module modules/libphp5.so -==> You must also add these lines: -==> Include conf/extra/php5_module.conf +==> and: ==> Include /etc/httpd/conf/extra/httpd-zm.conf EOF - touch /srv/zoneminder/zm_backup.sql } - -## arg 1: the new package version -## arg 2: the old package version post_upgrade() { - /srv/zoneminder/bin/zmupdate.pl -f >/dev/null + /usr/bin/zmupdate.pl -f >/dev/null +} + +post_remove() { + cat << EOF +Note: +==> To clean Zoneminder mysql database, run as root: +==> "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" + +==> 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/httpd-zm.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" + +==> edit /etc/php/php.ini and remove "/etc" and "/usr/share/zoneminder" +==> in the open_basedir. +EOF } -# vim:set ts=2 sw=2 et: diff --git a/pcr/zoneminder/zoneminder.service b/pcr/zoneminder/zoneminder.service new file mode 100644 index 000000000..ba41e8926 --- /dev/null +++ b/pcr/zoneminder/zoneminder.service @@ -0,0 +1,14 @@ +[Unit] +Description=Capture, analyse, record and monitor video security cameras +After=network.target remote-fs.target +Required=mysqld.service + +[Service] +Type=forking +PIDFile=/run/zm.pid +ExecStart=/usr/bin/zmpkg.pl start +ExecRestart=/usr/bin/zmpkg.pl restart +ExecStop=/usr/bin/zmpkg.pl stop + +[Install] +WantedBy=multi-user.target |