diff options
-rw-r--r-- | pcr/zoneminder/PKGBUILD | 99 | ||||
-rw-r--r-- | pcr/zoneminder/httpd-zoneminder.conf (renamed from pcr/zoneminder/httpd-zm.conf) | 0 | ||||
-rw-r--r-- | pcr/zoneminder/patch-ffmpeg-configure.patch | 26 | ||||
-rw-r--r-- | pcr/zoneminder/patch-libavcodec-detection.patch | 11 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder (renamed from pcr/zoneminder/zm.rc.d) | 0 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder-1.25.0-kernel35.patch | 21 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder.install | 120 | ||||
-rw-r--r-- | pcr/zoneminder/zoneminder.service | 1 |
8 files changed, 156 insertions, 122 deletions
diff --git a/pcr/zoneminder/PKGBUILD b/pcr/zoneminder/PKGBUILD index 64c3f94b0..e5e54537b 100644 --- a/pcr/zoneminder/PKGBUILD +++ b/pcr/zoneminder/PKGBUILD @@ -8,39 +8,75 @@ pkgname=zoneminder pkgver=1.25.0 -pkgrel=19 +pkgrel=20 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) +arch=( + i686 + x86_64 + mips64el +) +backup=( + etc/zm.conf +) +url="http://www.$pkgname.com" +license=( + GPL +) depends=( - apache cambozola ffmpeg-static 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 + apache + cambozola + ffmpeg-static + 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 +) +optdepends=( + netpbm ) -makedepends=(netpbm) install=$pkgname.install source=( http://www.$pkgname.com/downloads/ZoneMinder-$pkgver.tar.gz - httpd-zm.conf - zm.rc.d + httpd-$pkgname.conf + $pkgname $pkgname.service patch-ffmpeg-0.11.patch ) -md5sums=( - eaefa14befd482154970541252aa1a39 - 72380d8793a784ec24cb6809aea4a739 - 034b61cda8849fc3001849e76ef26041 - 7487cc72ead82aea0bc78f2e4106ae1a - 81c8be870260142e2633eedf73c72040 +sha512sums=( + 3e18993b0539729491052c97d8c94227ccc089eb40277c2f07682f30049033303c7cfe9734fdac6d33ae67df29c76eb72bf7fbb5dae8227e8831fa603b61c375 + 4ce0d8eba9d006d258f5b8a83920fc17f1f602b96518d37b7a47cd9b6eb84ef2587641a6ba839a469c3f0e33b46475866187279ae3f8be0d4054b074ee5d6b08 + ab4e1d5ddaf4d9cd53d6ca59d7965902afd6a2dc830fbbafa270736c52c2b3563075fee860bb0276466f96e9dbfb71b259ac45a4ae2e4ead8eaec154a0159eb0 + cfb0eb87a989236c72741a496ddc6a73aa2696e5beaaca4836d3c231ddb24c7ef5e9f65e7afa49674f2115cbfa4a07c75486e1947ce294c816ddbb875f3b99cf + 382799ad6add1632d934544230520f942dae37913b58cfa19e0cb2b11e7002267b1fdb9aa535f2217bcccf0c85c4d754f316dc3980a3ca267e5b3f5500536024 ) + build() { cd $srcdir/ZoneMinder-$pkgver + # ZM_RUNDIR need change to run dir export CPPFLAGS=-D__STDC_CONSTANT_MACROS\ - ZM_SSL_LIB=gnutls + 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>/'\ @@ -61,13 +97,15 @@ build() { /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 - sed -i -e '/ZM_PATH_SOCKS/,+1 s/tmp\/zm/run/; - /ZM_PATH_LOGS/,+1 s/zm/zonemider/; - /ZM_PATH_SWAP/,+1 s/zm/zonemider/'\ + # 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 + # 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 @@ -139,11 +177,12 @@ build() { package() { cd $srcdir/ZoneMinder-$pkgver - make DESTDIR=$pkgdir RUNDIR=$pkdir/run ZM_RUNDIR=$pkgdir/run install + make DESTDIR=$pkgdir install mkdir -p $pkgdir/{etc/{httpd/conf/extra,rc.d},srv/http/{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/srv/http/$pkgname/$i $pkgdir/var/cache/$pkgname/$i @@ -153,9 +192,9 @@ package() { ln -s /srv/http/cgi-bin $pkgdir/srv/http/$pkgname ln -s /usr/share/cambozola/cambozola.jar $pkgdir/srv/http/$pkgname - 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/${pkgname}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 + 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 } diff --git a/pcr/zoneminder/httpd-zm.conf b/pcr/zoneminder/httpd-zoneminder.conf index aeb089bc1..aeb089bc1 100644 --- a/pcr/zoneminder/httpd-zm.conf +++ b/pcr/zoneminder/httpd-zoneminder.conf diff --git a/pcr/zoneminder/patch-ffmpeg-configure.patch b/pcr/zoneminder/patch-ffmpeg-configure.patch deleted file mode 100644 index ba1674a4a..000000000 --- a/pcr/zoneminder/patch-ffmpeg-configure.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- configure.old 2011-08-23 12:10:37.000000000 -0300 -+++ configure 2012-09-26 16:23:33.211940267 -0300 -@@ -3026,8 +3026,8 @@ - fi - - --FFMPEG_LIBS="-L${FFMPEG_PREFIX}/${LIB_ARCH}" --FFMPEG_CFLAGS="-I${FFMPEG_PREFIX}/include" -+FFMPEG_LIBS=`pkg-config --cflags libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswscale` -+FFMPEG_CFLAGS=`pkg-config --cflags libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswscale` - - - ---- configure.ac.old 2011-08-23 12:10:32.000000000 -0300 -+++ configure.ac 2012-09-26 18:16:44.146848335 -0300 -@@ -88,8 +88,8 @@ - e.g. --with-ffmpeg=/usr/local]) - ) - AC_SUBST(FFMPEG_PREFIX) --FFMPEG_LIBS="-L${FFMPEG_PREFIX}/${LIB_ARCH}" --FFMPEG_CFLAGS="-I${FFMPEG_PREFIX}/include" -+FFMPEG_LIBS=`pkg-config --libs libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswscale` -+FFMPEG_CFLAGS=`pkg-config --libs libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswscale` - AC_SUBST(FFMPEG_LIBS) - AC_SUBST(FFMPEG_CFLAGS) - diff --git a/pcr/zoneminder/patch-libavcodec-detection.patch b/pcr/zoneminder/patch-libavcodec-detection.patch deleted file mode 100644 index 0aaa9bc23..000000000 --- a/pcr/zoneminder/patch-libavcodec-detection.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- configure.ac~ 2012-07-15 22:27:11.195257379 +0100
-+++ configure.ac 2012-07-15 22:24:34.308268675 +0100
-@@ -276,7 +276,7 @@
- AC_CHECK_LIB(avutil,av_malloc,,AC_MSG_WARN(libavutil.a may be required for MPEG streaming))
- # Don't bother to warn about this one
- AC_CHECK_LIB(avcore,av_image_copy,,)
--AC_CHECK_LIB(avcodec,avcodec_init,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
-+AC_CHECK_LIB(avcodec,avcodec_open,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
- AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))
- AC_CHECK_LIB(avdevice,avdevice_register_all,,AC_MSG_WARN(libavdevice.a may be required for MPEG streaming))
- AC_CHECK_LIB(swscale,sws_scale,,,-lswscale)
\ No newline at end of file diff --git a/pcr/zoneminder/zm.rc.d b/pcr/zoneminder/zoneminder index c4cbf4d3f..c4cbf4d3f 100644 --- a/pcr/zoneminder/zm.rc.d +++ b/pcr/zoneminder/zoneminder diff --git a/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch b/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch deleted file mode 100644 index 9939dc5c3..000000000 --- a/pcr/zoneminder/zoneminder-1.25.0-kernel35.patch +++ /dev/null @@ -1,21 +0,0 @@ -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 -@@ -739,7 +739,7 @@ void LocalCamera::Terminate() - { - Debug( 3, "Terminating video stream" ); - //enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- enum v4l2_buf_type type = v4l2_data.fmt.type; -+ enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type; - if ( vidioctl( vid_fd, VIDIOC_STREAMOFF, &type ) < 0 ) - Error( "Failed to stop capture stream: %s", strerror(errno) ); - -@@ -1519,7 +1519,7 @@ int LocalCamera::PrimeCapture() - - Debug( 3, "Starting video stream" ); - //enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- enum v4l2_buf_type type = v4l2_data.fmt.type; -+ enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type; - if ( vidioctl( vid_fd, VIDIOC_STREAMON, &type ) < 0 ) - Fatal( "Failed to start capture stream: %s", strerror(errno) ); - } diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install index 5e62cc23e..899e2a5d1 100644 --- a/pcr/zoneminder/zoneminder.install +++ b/pcr/zoneminder/zoneminder.install @@ -8,7 +8,7 @@ pre_install() { fi fi if [ -L /srv/http/zoneminder/images ]; then - l=$(readlink /srv/http/zoneminder/images ) + l=$(readlink /srv/http/zoneminder/images) if [ $l != /var/cache/zoneminder/images ]; then abort=true fi @@ -26,23 +26,73 @@ EOF } post_install() { - if [ -d /var/log/zoneminder ]; then - mkdir -m 0755 /var/log/zoneminder + if [[ -d /var/log/zoneminder ]]; then + chmod 0755 /var/log/zoneminder chown http.http /var/log/zoneminder else - chmod 0755 /var/log/zoneminder + 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 + sed -i -e ' + /^;extension=mysql.so/ s/^;//; + /^#extension=mysql.so/ s/^#//; + /^;extension=mysqli.so/ s/^;//; + /^#extension=mysqli.so/ s/^#//; + /^;extension=gd.so/ s/^;//; + /^#extension=gd.so/ s/^#//; + /^;extension=gettext.so/ s/^;//; + /^#extension=gettext.so/ s/^#//; + /^;extension=mcrypt.so/ s/^;//; + /^#extension=mcrypt.so/ s/^#//; + /^;extension=session.so/ s/^;//; + /^#extension=session.so/ s/^#//; + /^;extension=sockets.so/ s/^;//; + /^#extension=sockets.so/ s/^#//; + /^;extension=openssl.so/ s/^;//; + /^#extension=openssl.so/ s/^#//; + /^;extension=ftp.so/ s/^;//; + /^#extension=ftp.so/ s/^#//; + /^;extension=zip.so/ s/^;//; + /^#extension=zip.so/ s/^#//; + /^;open_basedir/ s/^;//; + /^#open_basedir/ s/^#//; + /^open_basedir/ s/:\/etc//; + /^open_basedir/ s/:\/etc\///; + /^open_basedir/ s/$/:\/etc/; + /^open_basedir/ s/:\/srv\/http\/zoneminder//; + /^open_basedir/ s/:\/srv\/http\/zoneminder\///; + /^open_basedir/ s/$/:\/srv\/http\/zoneminder/; + ' /etc/php/php.ini || read + sed -i -e ' + /^LoadModule php5_module modules\/libphp5.so/d; + /^LoadModule rewrite_module modules\/mod_rewrite.so/ s/$/\nLoadModule php5_module modules\/libphp5.so/; + /^# PHP 5/d; + /^# ZoneMinder/d; + /^Include \/etc\/httpd\/conf\/extra\/php5_module.conf/d; + /^Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d; + /^Include conf\/extra\/httpd-default.conf/ s/$/\n\n# PHP 5\n\Include \/etc\/httpd\/conf\/extra\/php5_module.conf\n\n# ZoneMinder\nInclude \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/; + ' /etc/httpd/conf/httpd.conf || read cat << EOF -Note: +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: +==> 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: +Note for php: ==> You must uncomment that line in /etc/php/php.ini: ==> "extension=mysql.so" ==> check and make sure these are uncommented: @@ -52,55 +102,59 @@ Note: ==> "extension=mysqli.so" ==> "extension=session.so" ==> "extension=sockets.so" - -==> You must edit /etc/php/php.ini and add to open_basedir "/etc" and -==> "/usr/share/zoneminder" like 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" -==> Otherwise ZoneMinder will be unable to read /etc/zm.conf -==> or display its own web directory -==> And set your timezone in php.ini: date.timezone = <my_country>/<my_city> +==> and set your timezone in php.ini: +==> "date.timezone = <your_country>/<your_city>" -Note: +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-zm.conf" +==> "Include /etc/httpd/conf/extra/httpd-zoneminder.conf" EOF } post_upgrade() { + post_install /usr/bin/zmupdate.pl -f >/dev/null - if [ -d /var/log/zoneminder ]; then - mkdir -m 0755 /var/log/zoneminder - chown http.http /var/log/zoneminder - else - chmod 0755 /var/log/zoneminder - chown http.http /var/log/zoneminder - fi } post_remove() { - if [ -d /run/zoneminder ]; then - rm -vr /run/zoneminder - fi - if [ -d /tmp/zoneminder ]; then + if [[ -d /tmp/zoneminder ]]; then rm -vr /tmp/zoneminder fi + sed -i -e ' + /^open_basedir/ s/:\/srv\/http\/zoneminder//; + /^open_basedir/ s/:\/srv\/http\/zoneminder\///; + ' /etc/php/php.ini || read + sed -i -e ' + /^# ZoneMinder/d; + /Include \/etc\/httpd\/conf\/extra\/httpd-zoneminder.conf/d; + ' /etc/httpd/conf/httpd.conf || read cat << EOF Note: -==> To clean Zoneminder mysql database, run as root: +==> 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 -==> "Include /etc/httpd/conf/extra/httpd-zm.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: @@ -113,11 +167,11 @@ Note: ==> "extension=sockets.so" ==> "date.timezone = <my_country>/<my_city>" -==> Edit /etc/php/php.ini and remove "/etc" and "/usr/share/zoneminder/www" -==> in the open_basedir. +==> 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" +==> Remove log files and "zonemider" directory in "/var/log/zoneminder". -==> Backup and remove events images and temp dirs in "/var/cache/zoneminder" +==> Backup and remove "events", "images" and "temp" dirs in "/var/cache/zoneminder". EOF } diff --git a/pcr/zoneminder/zoneminder.service b/pcr/zoneminder/zoneminder.service index ba41e8926..05cae6f91 100644 --- a/pcr/zoneminder/zoneminder.service +++ b/pcr/zoneminder/zoneminder.service @@ -5,7 +5,6 @@ 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 |