commit:     f2e466918b4367d5d96582a2bba599383225308c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 16 19:25:24 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr 16 19:25:39 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2e46691

www-misc/zoneminder: Various fixes, work in progress

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 www-misc/zoneminder/files/10_zoneminder.conf-r1    |  17 ++
 www-misc/zoneminder/files/README.gentoo            |   6 +-
 .../files/zoneminder-1.30.2-diskspace.patch        |  15 ++
 www-misc/zoneminder/zoneminder-1.30.2-r1.ebuild    | 177 +++++++++++++++++++++
 4 files changed, 212 insertions(+), 3 deletions(-)

diff --git a/www-misc/zoneminder/files/10_zoneminder.conf-r1 
b/www-misc/zoneminder/files/10_zoneminder.conf-r1
new file mode 100644
index 00000000000..441c793d189
--- /dev/null
+++ b/www-misc/zoneminder/files/10_zoneminder.conf-r1
@@ -0,0 +1,17 @@
+ScriptAlias /zm/cgi-bin/ "/usr/libexec/zoneminder/cgi-bin/"
+
+<Directory "/usr/libexec/zoneminder/cgi-bin">
+  AllowOverride All
+  Options ExecCGI
+  Order allow,deny
+  Allow from all
+</Directory> 
+
+Alias /zoneminder "%ZM_WEBDIR%"
+
+<Directory "%ZM_WEBDIR%">
+  Options -Indexes MultiViews FollowSymLinks
+  AllowOverride All
+  Order allow,deny
+  Allow from all
+</Directory> 

diff --git a/www-misc/zoneminder/files/README.gentoo 
b/www-misc/zoneminder/files/README.gentoo
index 2ada7c7d0a4..07995214d1c 100644
--- a/www-misc/zoneminder/files/README.gentoo
+++ b/www-misc/zoneminder/files/README.gentoo
@@ -14,14 +14,14 @@
    for an example configuration snippet.
 
 4. Enable PHP in your webserver configuration,
-   enable short_open_tags in php.ini,
+   enable short_open_tags in php.ini (likely on by default now)
    set the time zone in php.ini,
    and restart/reload the webserver.
 
 5. Start the zoneminder daemon:
      /etc/init.d/zoneminder start
 
-6. Finally point your browser to http://your.webserver/zoneminder
+6. Finally point your browser to http://your.webserver/zm
 
 If you are upgrading, you will need to run the zmupdate.pl script:
-      /usr/bin/zmupdate.pl --version=oldversionnumber [--user=zmuser 
--pass=topsecretpassword]
+   /usr/bin/zmupdate.pl --version=oldversionnumber [--user=zmuser 
--pass=topsecretpassword]

diff --git a/www-misc/zoneminder/files/zoneminder-1.30.2-diskspace.patch 
b/www-misc/zoneminder/files/zoneminder-1.30.2-diskspace.patch
new file mode 100644
index 00000000000..fee5b783c35
--- /dev/null
+++ b/www-misc/zoneminder/files/zoneminder-1.30.2-diskspace.patch
@@ -0,0 +1,15 @@
+https://forums.zoneminder.com/viewtopic.php?t=24534
+& personal message by [email protected]_m
+
+diff -ruN ZoneMinder-1.30.2.orig/web/includes/functions.php 
ZoneMinder-1.30.2/web/includes/functions.php
+--- ZoneMinder-1.30.2.orig/web/includes/functions.php  2017-03-30 
20:43:06.000000000 +0200
++++ ZoneMinder-1.30.2/web/includes/functions.php       2017-04-16 
21:13:43.841371345 +0200
+@@ -1442,7 +1442,7 @@
+   return( $load[0] );
+ }
+ 
+-function getDiskPercent($path = ZM_DIR_EVENTS) {
++function getDiskPercent($path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS) {
+   $total = disk_total_space($path);
+   if ( $total === false ) {
+     Error("disk_total_space returned false. Verify the web account user has 
access to " . $path );

diff --git a/www-misc/zoneminder/zoneminder-1.30.2-r1.ebuild 
b/www-misc/zoneminder/zoneminder-1.30.2-r1.ebuild
new file mode 100644
index 00000000000..d37f30cc0bf
--- /dev/null
+++ b/www-misc/zoneminder/zoneminder-1.30.2-r1.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# TO DO:
+# * dependencies of unknown status:
+#      dev-perl/Device-SerialPort
+#      dev-perl/MIME-Lite
+#      dev-perl/MIME-tools
+#      dev-perl/PHP-Serialization
+#      virtual/perl-Archive-Tar
+#      virtual/perl-libnet
+#      virtual/perl-Module-Load
+
+EAPI=6
+
+inherit versionator perl-functions readme.gentoo-r1 cmake-utils depend.apache 
flag-o-matic systemd
+
+MY_PN="ZoneMinder"
+
+MY_CRUD_VERSION="3.1.0"
+
+DESCRIPTION="Capture, analyse, record and monitor any cameras attached to your 
system"
+HOMEPAGE="http://www.zoneminder.com/";
+SRC_URI="
+       https://github.com/${MY_PN}/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+       
https://github.com/FriendsOfCake/crud/archive/v${MY_CRUD_VERSION}.tar.gz -> 
Crud-${MY_CRUD_VERSION}.tar.gz
+"
+
+LICENSE="GPL-2"
+KEYWORDS=""
+IUSE="curl ffmpeg gcrypt gnutls +mmap +ssl libressl vlc"
+SLOT="0"
+
+REQUIRED_USE="
+       || ( ssl gnutls )
+"
+
+DEPEND="
+       app-eselect/eselect-php[apache2]
+       dev-lang/perl:=
+       dev-lang/php:*[apache2,cgi,curl,gd,inifile,pdo,mysql,mysqli,sockets]
+       dev-libs/libpcre
+       dev-perl/Archive-Zip
+       dev-perl/Class-Std-Fast
+       dev-perl/Data-Dump
+       dev-perl/Date-Manip
+       dev-perl/Data-UUID
+       dev-perl/DBD-mysql
+       dev-perl/DBI
+       dev-perl/IO-Socket-Multicast
+       dev-perl/SOAP-WSDL
+       dev-perl/Sys-CPU
+       dev-perl/Sys-MemInfo
+       dev-perl/URI-Encode
+       dev-perl/libwww-perl
+       sys-auth/polkit
+       sys-libs/zlib
+       virtual/ffmpeg
+       virtual/httpd-php:*
+       virtual/jpeg:0
+       virtual/mysql
+       virtual/perl-ExtUtils-MakeMaker
+       virtual/perl-Getopt-Long
+       virtual/perl-Sys-Syslog
+       virtual/perl-Time-HiRes
+       www-servers/apache
+       curl? ( net-misc/curl )
+       gcrypt? ( dev-libs/libgcrypt:0= )
+       gnutls? ( net-libs/gnutls )
+       mmap? ( dev-perl/Sys-Mmap )
+       ssl? (
+               !libressl? ( dev-libs/openssl:0= )
+               libressl? ( dev-libs/libressl:0= )
+       )
+       vlc? ( media-video/vlc[live] )
+"
+RDEPEND="${DEPEND}"
+
+# we cannot use need_httpd_cgi here, since we need to setup permissions for the
+# webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
+need_apache
+
+S=${WORKDIR}/${MY_PN}-${PV}
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.26.5"-automagic.patch
+       "${FILESDIR}/${PN}-1.28.1"-mysql_include_path.patch
+       "${FILESDIR}/${PN}-1.30.2"-diskspace.patch
+)
+
+MY_ZM_WEBDIR=/usr/share/zoneminder/www
+
+src_prepare() {
+       cmake-utils_src_prepare
+
+       rmdir "${S}/web/api/app/Plugin/Crud" || die
+       mv "${WORKDIR}/crud-${MY_CRUD_VERSION}" "${S}/web/api/app/Plugin/Crud" 
|| die
+}
+
+src_configure() {
+       append-cxxflags -D__STDC_CONSTANT_MACROS
+       perl_set_version
+
+       mycmakeargs=(
+               -DZM_PERL_SUBPREFIX=${VENDOR_LIB#/usr}
+               -DZM_TMPDIR=/var/tmp/zm
+               -DZM_SOCKDIR=/var/run/zm
+               -DZM_WEB_USER=apache
+               -DZM_WEB_GROUP=apache
+               -DZM_WEBDIR=${MY_ZM_WEBDIR}
+               -DZM_NO_MMAP="$(usex mmap OFF ON)"
+               -DZM_NO_X10=OFF
+               -DZM_NO_FFMPEG="$(usex ffmpeg OFF ON)"
+               -DZM_NO_CURL="$(usex curl OFF ON)"
+               -DZM_NO_LIBVLC="$(usex vlc OFF ON)"
+               -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL="$(usex ssl OFF ON)"
+               -DHAVE_GNUTLS="$(usex gnutls ON OFF)"
+               -DHAVE_GCRYPT="$(usex gcrypt ON OFF)"
+       )
+
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       # the log directory
+       keepdir /var/log/zm
+       fowners apache:apache /var/log/zm
+
+       # the logrotate script
+       insinto /etc/logrotate.d
+       newins distros/ubuntu1204/zoneminder.logrotate zoneminder
+
+       # now we duplicate the work of zmlinkcontent.sh
+       keepdir /var/lib/zoneminder /var/lib/zoneminder/images 
/var/lib/zoneminder/events /var/lib/zoneminder/api_tmp
+       fperms -R 0775 /var/lib/zoneminder
+       fowners -R apache:apache /var/lib/zoneminder
+       dosym /var/lib/zoneminder/images ${MY_ZM_WEBDIR}/images
+       dosym /var/lib/zoneminder/events ${MY_ZM_WEBDIR}/events
+       dosym /var/lib/zoneminder/api_tmp ${MY_ZM_WEBDIR}/api/app/tmp
+
+       # bug 523058
+       keepdir ${MY_ZM_WEBDIR}/temp
+       fowners -R apache:apache ${MY_ZM_WEBDIR}/temp
+
+       # the configuration file
+       fperms 0640 /etc/zm.conf
+       fowners root:apache /etc/zm.conf
+
+       # init scripts etc
+       newinitd "${FILESDIR}"/init.d zoneminder
+       newconfd "${FILESDIR}"/conf.d zoneminder
+
+       # systemd unit file
+       systemd_dounit "${FILESDIR}"/zoneminder.service
+
+       cp "${FILESDIR}"/10_zoneminder.conf-r1 "${T}"/10_zoneminder.conf || die
+       sed -i "${T}"/10_zoneminder.conf -e "s:%ZM_WEBDIR%:${MY_ZM_WEBDIR}:g" 
|| die
+
+       dodoc AUTHORS BUGS ChangeLog INSTALL NEWS README.md TODO 
"${T}"/10_zoneminder.conf
+
+       perl_delete_packlist
+
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+
+       local v
+       for v in ${REPLACING_VERSIONS}; do
+               if ! version_is_at_least ${PV} ${v}; then
+                       elog "You have upgraded zoneminder and may have to 
upgrade your database now using the 'zmupdate.pl' script."
+               fi
+       done
+}

Reply via email to