pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

zoneminder: Clean up paths



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Tue May 30 08:42:26 2023 -0400
Changeset:	3b64cd5d328ba460159946d66effe3addd5bb6a2

Modified Files:
	zoneminder/Makefile
	zoneminder/PLIST
	zoneminder/TODO
	zoneminder/distinfo
	zoneminder/files/README-pkgsrc.md
	zoneminder/files/httpd-zoneminder.conf

Log Message:
zoneminder: Clean up paths

Stop using symlinks in the webroot.  Instead, alias cache, events and
images in httpd config.

Clean up php options; register_globals is so PHP early 5 and we
require 7.4.

Clean up and extend submodules.

Extend upgrading advice.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3b64cd5d328ba460159946d66effe3addd5bb6a2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zoneminder/Makefile                    | 38 ++++++++-------
 zoneminder/PLIST                       |  3 --
 zoneminder/TODO                        | 16 +++----
 zoneminder/distinfo                    |  3 ++
 zoneminder/files/README-pkgsrc.md      | 84 ++++++++++++++++++++++++++++------
 zoneminder/files/httpd-zoneminder.conf | 20 ++++++--
 6 files changed, 115 insertions(+), 49 deletions(-)

diffs:
diff --git a/zoneminder/Makefile b/zoneminder/Makefile
index ad4c54a4b1..57559e8418 100644
--- a/zoneminder/Makefile
+++ b/zoneminder/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.42 2019/06/18 12:36:59 gdt Exp $
 
 VERSION=	1.32.3
-PKGREVISION=	4
+PKGREVISION=	5
 # Distfile is ZoneMinder but package and tarball contents are zoneminder.
 NAME_DIST=	ZoneMinder
 NAME_LOWER=	zoneminder
@@ -15,9 +15,11 @@ GITHUB_PROJECT=	${NAME_DIST}
 GITHUB_TYPE=	tag
 GITHUB_TAG=	${PKGVERSION_NOREV}
 
-# Submodules as per ZoneMinder's .gitmodules file
-# \todo Add CakePHP-Enum-Behavior.
-GITHUB_SUBMODULES=	FriendsOfCake crud v3.0.10 web/api/app/Plugin/Crud
+# Submodules as per ZoneMinder's .gitmodules file, except that crud is no longer
+# at ZoneMinder so we use FriendsOfCake instead.
+# \todo Consider 3.0 vs v3.0.10, as the .gitmodules points to 3.0.
+GITHUB_SUBMODULES+=	FriendsOfCake crud v3.0.10 web/api/app/Plugin/Crud
+GITHUB_SUBMODULES+=	ZoneMinder CakePHP-Enum-Behavior master web/api/app/Plugin/CakePHP-Enum-Behavior
 
 MAINTAINER=	dsainty%NetBSD.org@localhost
 #MAINTAINER+=	gdt%NetBSD.org@localhost
@@ -80,33 +82,33 @@ CMAKE_ARGS+=		-DZM_RUNDIR=${VARBASE}/run/zm
 # should just be removed.
 OWN_DIRS_PERMS+=	${VARBASE}/run/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
 
+# NB: Startup script must create /var/run/zm.
 CMAKE_ARGS+=		-DZM_SOCKDIR=${VARBASE}/run/zm
-# \todo Consider /tmp vs /var/tmp.  For now, guess that it should
-# persist.
+# Choose /var/tmp for now.  \todo Revisit.
 CMAKE_ARGS+=		-DZM_TMPDIR=${VARBASE}/tmp/zm
+OWN_DIRS_PERMS+=	${VARBASE}/tmp/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
 CMAKE_ARGS+=		-DZM_LOGDIR=${VARBASE}/log/zm
-OWN_DIRS_PERMS+=	${VARBASE/log/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
+OWN_DIRS_PERMS+=	${VARBASE}/log/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
 
 # \todo Define this per-OS; /var/shm is for NetBSD
 ZM_SHM=			/var/shm
 CMAKE_ARGS+=		-DZM_PATH_MAP=${ZM_SHM}
 
-# ZM wants both a "cache" directory and a "content" directory; the
-# latter seems to fit "/var/db".
+# Cache directory is for js files to be served.  For now, use
+# /var/cache/zoneminder.  \todo Consider /tmp/zm instead.
 ZM_CACHE=		${VARBASE}/cache/zoneminder
 CMAKE_ARGS+=		-DZM_CACHEDIR=${ZM_CACHE}
 OWN_DIRS_PERMS+=	${ZM_CACHE} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
 
+# Storage of events; this should persist and is hence in /var/db.
+# \todo Understand how and why /images is used.
 ZM_CONTENT=		${VARBASE}/db/zoneminder
 CMAKE_ARGS+=		-DZM_CONTENTDIR=${ZM_CONTENT}
-OWN_DIRS_PERMS+=	${ZM_CONTENT} ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 755
+OWN_DIRS_PERMS+=	${ZM_CONTENT} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
 CMAKE_ARGS+=		-DZM_DIR_EVENTS=${ZM_CONTENT}/events
-OWN_DIRS_PERMS+=	${ZM_CONTENT}/events ${REAL_ROOT_USER} ${APACHE_GROUP} 775
+OWN_DIRS_PERMS+=	${ZM_CONTENT}/events ${APACHE_USER} ${APACHE_GROUP} 775
 CMAKE_ARGS+=		-DZM_DIR_IMAGES=${ZM_CONTENT}/images
-OWN_DIRS_PERMS+=	${ZM_CONTENT}/images ${REAL_ROOT_USER} ${APACHE_GROUP} 775
-
-# \todo Figure out temp - not in docs.
-OWN_DIRS_PERMS+=	${ZM_CONTENT}/temp ${REAL_ROOT_USER} ${APACHE_GROUP} 775
+OWN_DIRS_PERMS+=	${ZM_CONTENT}/images ${APACHE_USER} ${APACHE_GROUP} 775
 
 ## Dependencies other than perl and php.
 
@@ -184,6 +186,7 @@ DEPENDS+=	p5-MIME-Lite-[0-9]*:../../mail/p5-MIME-Lite
 DEPENDS+=	p5-MIME-tools-[0-9]*:../../mail/p5-MIME-tools
 DEPENDS+=	p5-Net-SFTP-Foreign-[0-9]*:../../net/p5-Net-SFTP-Foreign
 DEPENDS+=	p5-Sys-MemInfo-[0-9]*:../../sysutils/p5-Sys-MemInfo
+DEPENDS+=	p5-Number-Bytes-Human-[0-9]*:../../textproc/p5-Number-Bytes-Human
 DEPENDS+=	p5-libwww-[0-9]*:../../www/p5-libwww
 
 # All perl scripts need interpreter patching (REPLACE_PERL), while a large
@@ -337,11 +340,6 @@ post-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/scripts/zm ${DESTDIR}${PREFIX}/share/examples/rc.d/zoneminder
 .endif
 	${INSTALL_DATA} ${WRKSRC}/db/*.sql ${DESTDIR}${PREFIX}/share/zoneminder/db/
-	rmdir ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/events || ${TRUE}
-	rmdir ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/images || ${TRUE}
-	${LN} -s ${ZM_CONTENT}/temp ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/temp
-	${LN} -s ${ZM_CONTENT}/events ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/events
-	${LN} -s ${ZM_CONTENT}/images ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/images
 	${INSTALL_DATA} files/README-pkgsrc.md ${DESTDIR}${PREFIX}/${DOCDIR}
 
 .include "../../mk/dlopen.buildlink3.mk"
diff --git a/zoneminder/PLIST b/zoneminder/PLIST
index 95f156f7b7..b4570582a3 100644
--- a/zoneminder/PLIST
+++ b/zoneminder/PLIST
@@ -7498,7 +7498,6 @@ ${ZM_HTTPD_ROOT}/css/bootstrap.min.css.map
 ${ZM_HTTPD_ROOT}/css/overlay.css
 ${ZM_HTTPD_ROOT}/css/reset.css
 ${ZM_HTTPD_ROOT}/css/spinner.css
-${ZM_HTTPD_ROOT}/events
 ${ZM_HTTPD_ROOT}/fonts/MaterialIcons-Regular.eot
 ${ZM_HTTPD_ROOT}/fonts/MaterialIcons-Regular.ttf
 ${ZM_HTTPD_ROOT}/fonts/MaterialIcons-Regular.woff
@@ -7512,7 +7511,6 @@ ${ZM_HTTPD_ROOT}/fonts/license.md
 ${ZM_HTTPD_ROOT}/graphics/favicon.ico
 ${ZM_HTTPD_ROOT}/graphics/spinner.png
 ${ZM_HTTPD_ROOT}/graphics/transparent.png
-${ZM_HTTPD_ROOT}/images
 ${ZM_HTTPD_ROOT}/includes/Control.php
 ${ZM_HTTPD_ROOT}/includes/Event.php
 ${ZM_HTTPD_ROOT}/includes/Filter.php
@@ -7867,7 +7865,6 @@ ${ZM_HTTPD_ROOT}/skins/classic/views/video.php
 ${ZM_HTTPD_ROOT}/skins/classic/views/watch.php
 ${ZM_HTTPD_ROOT}/skins/classic/views/zone.php
 ${ZM_HTTPD_ROOT}/skins/classic/views/zones.php
-${ZM_HTTPD_ROOT}/temp
 ${ZM_HTTPD_ROOT}/tools/mootools/mootools-core-1.6.0-compat.js
 ${ZM_HTTPD_ROOT}/tools/mootools/mootools-core-compat.js.URL
 ${ZM_HTTPD_ROOT}/tools/mootools/mootools-core.js
diff --git a/zoneminder/TODO b/zoneminder/TODO
index 9b25c7a19a..a74cd75b17 100644
--- a/zoneminder/TODO
+++ b/zoneminder/TODO
@@ -16,12 +16,10 @@
    https://github.com/ZoneMinder/zoneminder/issues/2078#issuecomment-395094624
 
    new deps: pecl-apcu, file-slurp, format-human-bytes
-   hoist deps to pkgsrc: wip/p5-Sys-MemInfo
-
-   There is a concept of a git submodule for CakePHP-Enum-Behavior,
-   and that upstream has not yet accepted a needed change.  However it
-   has also not been rejected.
-   https://github.com/zoneminder/CakePHP-Enum-Behavior
-   https://github.com/asper/CakePHP-Enum-Behavior
-   https://github.com/asper/CakePHP-Enum-Behavior/pull/8
- 
\ No newline at end of file
+
+   Install conf.d/zmpaths.conf setting the paths we set, because that
+   seems necessary.
+
+   Resolve zmc startup hang (zmdc expects zmc to exit, but it doesn't??).
+
+   Resolve nph-zms vs zms, and zms lockup on events view.
diff --git a/zoneminder/distinfo b/zoneminder/distinfo
index 02dae1418b..3f970117bd 100644
--- a/zoneminder/distinfo
+++ b/zoneminder/distinfo
@@ -6,6 +6,9 @@ Size (FriendsOfCake-crud-v3.0.10.tar.gz) = 72960 bytes
 BLAKE2s (ZoneMinder-1.32.3.tar.gz) = 7b82f17c3584afc882f0dbfc6ccdbaa9f5659cbd6aa0e4cf90f03f3a94a23ec7
 SHA512 (ZoneMinder-1.32.3.tar.gz) = 1226127a1352ebc6e80ba0cbdb3ecbae27cf64a75b7652abc651e1440b709456f71f5a7f700e37575a8f4c8cd2a0904e5be7721f61ae040365b60ed05447a9c8
 Size (ZoneMinder-1.32.3.tar.gz) = 10656921 bytes
+BLAKE2s (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = 618af60eff56f659a700ff3bc9a3721c1b5a1ba8d15bc2a4213a4022297553bc
+SHA512 (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = fa51aa34749cf0e7c9c484c4d65718696230291780df1bac9a5ca8144a230d5cdfdf2ff2fae413248a09ddd14615dbe88b111713e11173aa9d9078c5b3c9064c
+Size (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = 3506 bytes
 SHA1 (patch-CMakeLists.txt) = cfc565e597d48c6b3c54e1aba53e5f1b4e19f34a
 SHA1 (patch-cmake_Modules_Pod2Man.cmake) = f0a1462037fc63fa9f35d0595f4f50946f5518e7
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in) = 3bf4e5e8276a682695db640e6608dd14c7315320
diff --git a/zoneminder/files/README-pkgsrc.md b/zoneminder/files/README-pkgsrc.md
index 38385d3210..73dd1b52ef 100644
--- a/zoneminder/files/README-pkgsrc.md
+++ b/zoneminder/files/README-pkgsrc.md
@@ -2,7 +2,12 @@
 
 This is a local pkgsrc README for the zoneminder package.  It attempts
 not to duplicate the upstream documentation.  (Arguably, some of this
-should be pushed upstream.)
+should be pushed upstream.)  This REAMDE presumes familiarity with
+zoneminder, adminstering a web server, adminstering mysql, and
+hand-typing SQL UPDATE statements.
+
+We write /var for ${VARBASE}, /usr/pkg for ${PREFIX}, and /usr/pkg/etc
+for ${PKG_SYSCONFDIR}, without loss of generality.
 
 # pkgsrc-specific notes
 
@@ -34,8 +39,8 @@ which are for Ubuntu, but seem mostly generic.
 Specifically, see "Step 5: Configure the ZoneMinder Database".
 
 The default password is "zmpass".  You may (probably should) change
-this to something else, and update ZM_DB_PASS in
-${PKG_SYSCONFDIR}/zm.conf.
+this to something else, and set ZM_DB_PASS in
+e.g. /usr/pkg/etc/zm/zmpass.conf.
 
 # Other setup
 
@@ -47,34 +52,85 @@ more information.
  
 # Web setup
 
+## apache
+
 See "Step 7: Configure Apache correctly", but edit the apache config
 file instead of using the not-in-pkgsrc a2enmod command.
 
 mod_cgid is a hard requirement.  zm appears to work without rewrite
 and expire.  headers is default on.  Enabling a zoneminder apache
-module does not make sense.
+module does not make sense, but upstream maybe implies that you
+should.
 
-Perhaps, one needs to use prefork instead of event. \todo Validate.
+For now One needs to use prefork instead of event with cgid, because
+php is built without threads.
 
 Zoneminder installs
-${PREFIX}/share/examples/zoneminder/apache/zoneminder.conf, which does
-two things:
+/usr/pkg/share/examples/zoneminder/apache/httpd-zoneminder.conf,
+which does two things:
   - aliases /zm to the zm main dir and /zm/cgi-bin/ to the zm cgi directory
   - allows those paths to 127.0.0.1
 Either `Include` this, copy/modify and `Include`, or insert into
 httpd.conf.  (You will need to adjust the IP acl if you want
-off-machine access; this should be addressed upstream but does not
-seem to be.)
+off-machine access.)
+
+It is for future study to use www/ap2-fcgid instead of mod_cgid, and
+then one could use the event MPM.
+
+## nginx
+
+After you figure it out, please send patches to add an nginx config
+file.  Likely one would use php_fpm; Makefile guesses so.
 
 # Upgrading from previous versions
 
+As always, backup everything, diff all configs from upstream before
+and minimize, save deltas, and merge to new upstreams keeping intended
+changes.  This is going to be worse than most upgrades.
+
+## Standard zoneminder advice
+
 Upgrade a database from an older version of ZoneMinder via:
 
   zmupdate.pl -u root [-p <password>]
 
-NB: Before doing this ensure that $prefix/etc/conf.d exists.
-Zoneminder 1.32 will attempt to remove config from the database and
-place it in e.g. `/usr/pkg/etc/conf.d/zmcustom.conf`.
+NB: Zoneminder 1.32 will attempt to remove config from the database
+and place it in e.g. `/usr/pkg/etc/zm/conf.d/zmcustom.conf`.  The
+package attempts to create the directory, but make one more backup
+than you think you need.
+
+## Zoneminder path woes
+
+In theory, one wouldn't have to set paths, but it seems one does.  Go
+over the list at
+https://github.com/ZoneMinder/zoneminder/blob/release-1.32/INSTALL and
+set some.
+
+## Issues due to pkgsrc changes from 1.30 to 1.32
+
+pkgsrc changed the config dir from /usr/pkg/etc to /usr/pkg/etc/zm, so
+you should move zm.conf.
+
+There are mumblings that one should not have symlinks in the webroot.
+
+When editing in conf.d, beware zmcustom.conf~ which might or might not
+also be read.
+
+pkgsrc changed from /var/cache/zoneminder to /var/db/zoneminder.
+While merging configs, pay extra attention to stray /var/cache
+pathnames.
+
+### Storage
+
+Zoneminder has "Storage" configured (Options, Storage), and it is
+possible that it used to be /var/cache/zoneminder/events and should
+now be /var/db/zoneminder/events.
+
+### Upload temp dir
+
+One can configure uploads and a temp dir in which to create them.
+That path is in the database as UPLOAD_LOC_DIR and can be a stray
+source of /var/cache/zoneminder.
 
 # Shared memory
 
@@ -82,7 +138,7 @@ Zoneminder tries to use a shm filesystem to store files that are then
 mmap'd.  (1.28 used SysV shm but that is no longer relevant.)
 
 On NetBSD, the compiled default might be /dev/shm but the right place
-is /var/shm.  This can be changed in Options in the web interface.
+is /var/shm.  This can be changed in zmcustom.conf via ZM_PATH_MAP.
 
 (One might need a lot of space, or to turn the buffer down to fewer
 frames; this is not about pkgsrc.)
@@ -91,4 +147,4 @@ Somtimes, the shm file can get into a bad state and be zero length.
 This might be a bad error path during camera timeouts; it seems to
 happen more with bad wifi connections.  Turning up the timeouts in the
 config (e.g. wait 10s or 30s before giving up instead of 2s) probably
-also helps.
+also helps.  This is also not about pkgsrc.
diff --git a/zoneminder/files/httpd-zoneminder.conf b/zoneminder/files/httpd-zoneminder.conf
index d3dd8648bd..f478ec1bf2 100644
--- a/zoneminder/files/httpd-zoneminder.conf
+++ b/zoneminder/files/httpd-zoneminder.conf
@@ -41,12 +41,26 @@ ScriptAlias /zm/cgi-bin/ "@ZM_HTTPD_CGIBIN@/"
   </RequireAny>
 </Directory>
 
-# \todo Upstream does not set php_flags.
+Alias /zm/cache "/var/cache/zoneminder"
+<Directory "/var/cache/zoneminder">
+  <RequireAny>
+    Require ip 127.0.0.1
+    Require ip ::
+  </RequireAny>
+</Directory>
+
+Alias /zm/events "/var/db/zoneminder/events"
+Alias /zm/images "/var/db/zoneminder/images"
+<Directory "/var/db/zoneminder">
+  <RequireAny>
+    Require ip 127.0.0.1
+    Require ip ::
+  </RequireAny>
+</Directory>
+
 # \todo Upstream sets Options.
 Alias /zm "@ZM_HTTPD_ROOT@"
 <Directory "@ZM_HTTPD_ROOT@">
-  php_flag register_globals off
-  php_flag short_open_tag on
   DirectoryIndex index.php
   <RequireAny>
     Require ip 127.0.0.1


Home | Main Index | Thread Index | Old Index