diff --git a/CMakeLists.txt b/CMakeLists.txt index 221ee4089..d770645c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,14 +141,17 @@ set(ZM_PERL_SEARCH_PATH "" CACHE PATH where ZM_PERL_MM_PARMS has been modified such that ZoneMinder's Perl modules are installed outside Perl's default search path.") set(ZM_TARGET_DISTRO "" CACHE STRING - "Build ZoneMinder for a specific distribution. Currently, valid names are: f21, f20, el6, OS13") + "Build ZoneMinder for a specific distribution. Currently, valid names are: f21, f22, el6, el7, OS13") # Reassign some variables if a target distro has been specified -if((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20")) +if((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f22")) set(ZM_RUNDIR "/var/run/zoneminder") set(ZM_SOCKDIR "/var/lib/zoneminder/sock") set(ZM_TMPDIR "/var/lib/zoneminder/temp") set(ZM_LOGDIR "/var/log/zoneminder") + set(ZM_CONFIG_DIR "/etc/zm") + set(ZM_WEBDIR "/usr/share/zoneminder/www") + set(ZM_CGIDIR "/usr/libexec/zoneminder/cgi-bin") elseif(ZM_TARGET_DISTRO STREQUAL "el6") set(ZM_RUNDIR "/var/run/zoneminder") set(ZM_SOCKDIR "/var/lib/zoneminder/sock") @@ -173,7 +176,7 @@ elseif(ZM_TARGET_DISTRO STREQUAL "OS13") set(ZM_WEB_GROUP "www") set(ZM_WEBDIR "/srv/www/htdocs/zoneminder") set(ZM_CGIDIR "/srv/www/cgi-bin") -endif((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20")) +endif((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f22")) # Required for certain checks to work set(CMAKE_EXTRA_INCLUDE_FILES @@ -688,13 +691,13 @@ if(ZM_ONVIF) endif(ZM_ONVIF) # Process distro subdirectories -if((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20")) +if((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f22")) add_subdirectory(distros/fedora) elseif((ZM_TARGET_DISTRO STREQUAL "el6") OR (ZM_TARGET_DISTRO STREQUAL "el7")) add_subdirectory(distros/redhat) elseif(ZM_TARGET_DISTRO STREQUAL "OS13") add_subdirectory(distros/opensuse) -endif((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20")) +endif((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f22")) # Print optional libraries detection status message(STATUS "Optional libraries found:${optlibsfound}") @@ -715,7 +718,7 @@ endif(zmconfgen_result EQUAL 0) if(NOT EXISTS "${ZM_CONFIG_DIR}/zm.conf") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}") else(NOT EXISTS "${ZM_CONFIG_DIR}/zm.conf") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new" DESTINATION "${ZM_CONFIG_DIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}" RENAME "zm.conf.new") endif(NOT EXISTS "${ZM_CONFIG_DIR}/zm.conf") # Uninstall target diff --git a/INSTALL b/INSTALL index 8f892e840..35deec3c4 100644 --- a/INSTALL +++ b/INSTALL @@ -92,8 +92,9 @@ NOTE: The database server, database name, user and password can be different and 7) Populate the zoneminder database using the script zm_create.sql. This should be found in /share/zoneminder/db or in the project/db directory. 8) Create an apache virtual host for ZoneMinder. Make sure to use the same paths as ZM_WEBDIR and ZM_CGIDIR in /etc/zm.conf -9) Create other config if desired (e.g. rsyslog, logrotate and such). Some of this can be found in /share/zoneminder/misc or project/misc directory -10) Setup an appropriate startup script for your system. Two generic startup scripts have been provided, a legacy Sys V Init script and a Systemd service file. +9) Verify date.timezone is set to your timezone. This parameter is often found inside the system php.ini file. Consult your distribution's documentation for the proper way to set this value. +10) Create other config if desired (e.g. rsyslog, logrotate and such). Some of this can be found in /share/zoneminder/misc or project/misc directory +11) Setup an appropriate startup script for your system. Two generic startup scripts have been provided, a legacy Sys V Init script and a Systemd service file. *Sys V Init Setup* - Copy the sys v init script /scripts/zm from the build folder to /etc/init. diff --git a/README.md b/README.md index 381b2dd54..4aa63b1a6 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,6 @@ root@host:~# gdebi /root/zoneminder_1.26.4-1_amd64.deb; #### Fedora / CentOS / RHEL -***DRAFT* ** Needs Testing - ##### Background The following method documents how to build ZoneMinder into an RPM package, compatible with Fedora, Redhat, CentOS, and other compatible clones. This is exactly how the RPMS in zmrepo are built. diff --git a/distros/debian/init.d b/distros/debian/init.d index d3354c1d8..f22143c38 100644 --- a/distros/debian/init.d +++ b/distros/debian/init.d @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p $RUNDIR && chown www-data:www-data $RUNDIR mkdir -p $TMPDIR && chown www-data:www-data $TMPDIR $command start diff --git a/distros/debian_cmake/init.d b/distros/debian_cmake/init.d index cbc8fb10e..036bb695d 100644 --- a/distros/debian_cmake/init.d +++ b/distros/debian_cmake/init.d @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p $RUNDIR $TMPDIR && chown www-data:www-data $RUNDIR $TMPDIR $command start RETVAL=$? diff --git a/distros/fedora/CMakeLists.txt b/distros/fedora/CMakeLists.txt index c4275d45a..f49d451f1 100644 --- a/distros/fedora/CMakeLists.txt +++ b/distros/fedora/CMakeLists.txt @@ -1,5 +1,14 @@ # CMakeLists.txt for the Fedora Target Distro. +# Display a message to show the Fedora build options are being processed. +message([STATUS] "Starting Fedora Build Options" ...) + +# Create the ZoneMinder Apache config file +configure_file(zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) +configure_file(zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) +configure_file(zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY) +configure_file(zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) + # Download jscalendar & move files into position file(DOWNLOAD http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip STATUS download_jsc) if(download_jsc EQUAL 0) diff --git a/distros/fedora/README.Fedora b/distros/fedora/README.Fedora index a75efc185..3043d78fd 100644 --- a/distros/fedora/README.Fedora +++ b/distros/fedora/README.Fedora @@ -1,113 +1,145 @@ +What's New +========== + +1. The Apache ScriptAlias has been changed from "/cgi-bin/zm/zms" to + "/cgi-bin-zm/zms". This has been to done to avoid this bug: + https://bugzilla.redhat.com/show_bug.cgi?id=973067 + + IMPORTANT: ZoneMinder will not update this value during an upgrade. You must + manually update ZM_PATH_ZMS yourself under Options. This does not affect + new installs. + +2. The ZoneMinder config file, zm.conf, has been moved under /etc/zm. + +3. The ZoneMinder mysql account now requires "Create" permission. This change + must be done manually before ZoneMinder will run. See the installation steps + below. + +4. A new permission group called "Groups" has been added. This allows the + system administrator to assign "view", "edit", or "none" permission to + normal users, without giving them access to the rest of the ZoneMinder + system. During an upgrade, existing accounts will default to a Groups + permission of "none". + +5. This package now requires the HTTPS protocol to access the web portal. + Requests using HTTP will auto-redirect to HTTPS. See README.https for + more information. + +6. This package ships with the new ZoneMinder API enabled. + New installs ============ -1. Unless you are already using the MySQL server or you are running it - remotely you will need to ensure that the server is installed and secured: +1. This package supports either community-mysql-server or mariadb-server with + mariadb being the preferred choice. Unless you are already using MariaDB or + Mysql server, you need to ensure that the server is configured to start + during boot and properly secured by running: - sudo yum install community-mysql-server - - sudo systemctl enable mysqld - - sudo systemctl start mysqld.service - + sudo yum install mariadb-server + sudo systemctl enable mariadb + sudo systemctl start mariadb.service mysql_secure_installation - NOTE: The Fedora team currently recommends mysql-community over mariadb - -2. Using the password for the root account set during the previous step, you - will need to create the ZoneMinder database, assuming your database server - is local: - - mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql - mysqladmin -uroot -p reload - -3. The database needs a user. One is not created by default because this would - introduce an obvious security issue. The following should set this up: +2. Assuming the database is local and using the password for the root account + set during the previous step, you will need to create the ZoneMinder + database and configure a database account for ZoneMinder to use: + mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql mysql -u root -p - grant select,insert,update,delete,lock tables,alter,create - on zm.* to 'zmuser'@localhost identified by 'zmpass'; + mysql> grant select,insert,update,delete,lock tables,alter,create + on zm.* to 'zmuser'@localhost identified by 'zmpass'; + mysql> exit; + mysqladmin -u root -p reload - Obviously, change at least zmpass to an actual, secure password or - passphrase. You can change zmuser as well if you like. + The database account credentials, zmuser/zmpass, are arbitrary. Set them to + anything that suits your envinroment. -4. Edit /etc/zm.conf and, at the bottom, change ZM_DB_PASS and perhaps - ZM_DB_USER to match. +3. If you have chosen to change the zoneminder database account credentials to + something other than zmuser/zmpass, you must now edit /etc/zm/zm.conf. + Change ZM_DB_USER and ZM_DB_PASS to the values you created in the previous + step. -5. Edit /etc/php.ini, uncomment the date.timezone line, and add your local - timezone. For whatever reason, PHP will complain loudly if this is not set, - or if it is set incorrectly, and these complaints will show up in the - zoneminder logging system as errors. +4. Edit /etc/php.ini, uncomment the date.timezone line, and add your local + timezone. PHP will complain loudly if this is not set, or if it is set + incorrectly, and these complaints will show up in the zoneminder logging + system as errors. If you are not sure of the proper timezone specification to use, look at http://php.net/date.timezone -6. This package probably does not work with SELinux enabled at the moment. It - may be necessary to disable SELinux for httpd, or even completely for - ZoneMinder to function. This will be addressed in a later release. Run +5. Disable SELinux + + We currently do not have the resources to create and maintain an accurate + SELinux policy for ZoneMinder on Fedora. We will gladly accept pull + reqeusts from anyone who wishes to do the work. In the meantime, SELinux + will need to be disabled or put into permissive mode. + + To immediately disbale SELinux for the current seesion, issue the following + from the command line: sudo setenforce 0 - for testing, and edit /etc/sysconfig/selinux to disable it at boot time. + To permanently disable SELinux, edit /etc/selinux/config and change the + SELINUX line from "enforcing" to "disabled". This change will take + effect after a reboot. -7. IMPORTANT: Edit /etc/httpd/conf.d/zoneminder.conf and/or - /etc/httpd/conf/httpd.conf. - The httpd.conf file included with this version of Fedora processes the conf.d - folder after the default ScriptAlias directive in the httpd.conf file. - Previously, the conf.d folder was processed before the default ScriptAlias - directive. This causes a ScriptAlias overlap and breaks Zoneminder's - streaming abilities. +6. Now start the web server: - Reference: http://httpd.apache.org/docs/2.4/mod/mod_alias.html#order - Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=973067 + sudo systemctl enable httpd + sudo systemctl start httpd - WORKAROUND #1 - If you are running zoneminder on a dedicated server then the simplest - solution may be to simply comment out the line in httpd.conf that reads: +7. Now start zoneminder: - ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" - - WORKAROUND #2 - If you need both the default cgi-bin folder & the zoneminder cgi-bin folder - then a solution might be to move the following line before the default - ScriptAlias directive in the httpd.conf file: - - IncludeOptional conf.d/*.conf - -8. Now start the web server: - - sudo systemctl enable httpd.service - sudo systemctl start httpd.service - -9. Now start zoneminder: - - sudo systemctl enable zoneminder.service - sudo systemctl start zoneminder.service + sudo systemctl enable zoneminder + sudo systemctl start zoneminder Upgrades ======== -1. Update /etc/zm.conf. Check for any new settings and update the version - information. Comparing /etc/zm.conf and /etc/zm.conf.rpmnew should help to - do this. +1. Verify /etc/zm/zm.conf. -2. Add additional permissions to the zmuser account: + If zm.conf was manually edited before running the upgrade, the installation + may not overwrite it. In this case, it will create the file + /etc/zm/zm.conf.rpmnew. + + For example, this will happen if you are using database account credentials + other than zmuser/zmpass. + + Compare /etc/zm/zm.conf to /etc/zm/zm.conf.rpmnew. Verify that zm.conf + contains any new config settings that may be in zm.conf.rpmnew. + +2. Verify permissions of the zmuser account. + + Over time, the database account permissions required for normal operation + have changed. Verify the zmuser database account has been granted select, + insert, update, delete, lock tables, alter, and create permission to the + ZoneMinder database: mysql -u root -p - grant lock tables,alter,create on zm.* to - 'zmuser'@localhost identified by 'zmpass'; + mysql> show grants for zmuser@localhost; + mysql> exit; - Since this is an upgrade, the assumption is that the zmuser account already - has select, insert, update, and delete permission. + See step 2 of the Installation section to add missing permissions. -3. You will need to upgrade the ZoneMinder database as described in the - manual. Only if the previous step was succesful, may you run zmupdate like - so: +3. Verify the ZoneMinder Apache configuration file in the folder + /etc/httpd/conf.d. You will have a file called "zoneminder.conf" and there + may also be a file called "zoneminder.conf.rpmnew". If the rpmnew file + exists, inspect it and merge anything new in that file with zoneminder.conf. + +4. Upgrade the database before starting ZoneMinder. + + Most upgrades can be performed by executing the following command: - sudo zmupdate.pl --version= - - - If unsure then run it this way: + sudo zmupdate.pl + + Recent versions of ZoneMinder don't require any parameters added to the + zmupdate command. However, if ZoneMinder complains, you may need to call + zmupdate in the following manner: sudo zmupdate.pl --user=root --pass= --version= + +5. Now start zoneminder: + + sudo systemctl start zoneminder + diff --git a/distros/fedora/README.https b/distros/fedora/README.https new file mode 120000 index 000000000..18f7407c1 --- /dev/null +++ b/distros/fedora/README.https @@ -0,0 +1 @@ +../redhat/README.https \ No newline at end of file diff --git a/distros/fedora/zoneminder.conf b/distros/fedora/archive/zoneminder.conf similarity index 100% rename from distros/fedora/zoneminder.conf rename to distros/fedora/archive/zoneminder.conf diff --git a/distros/fedora/zoneminder.f20.spec b/distros/fedora/archive/zoneminder.f20.spec similarity index 100% rename from distros/fedora/zoneminder.f20.spec rename to distros/fedora/archive/zoneminder.f20.spec diff --git a/distros/fedora/zoneminder.logrotate b/distros/fedora/archive/zoneminder.logrotate similarity index 100% rename from distros/fedora/zoneminder.logrotate rename to distros/fedora/archive/zoneminder.logrotate diff --git a/distros/fedora/zoneminder.service b/distros/fedora/archive/zoneminder.service similarity index 100% rename from distros/fedora/zoneminder.service rename to distros/fedora/archive/zoneminder.service diff --git a/distros/fedora/zoneminder.tmpfiles b/distros/fedora/archive/zoneminder.tmpfiles similarity index 100% rename from distros/fedora/zoneminder.tmpfiles rename to distros/fedora/archive/zoneminder.tmpfiles diff --git a/distros/fedora/zoneminder.conf.in b/distros/fedora/zoneminder.conf.in new file mode 120000 index 000000000..fd0098cf5 --- /dev/null +++ b/distros/fedora/zoneminder.conf.in @@ -0,0 +1 @@ +../redhat/zoneminder.el7.conf.in \ No newline at end of file diff --git a/distros/fedora/zoneminder.f21.spec b/distros/fedora/zoneminder.f21.spec index c1875cf5a..6dfabceea 100644 --- a/distros/fedora/zoneminder.f21.spec +++ b/distros/fedora/zoneminder.f21.spec @@ -127,7 +127,7 @@ fi %files %defattr(-,root,root,-) %doc AUTHORS COPYING README.md distros/fedora/README.Fedora distros/fedora/jscalendar-doc -%config %attr(640,root,%{zmgid_final}) /etc/zm.conf +%config %attr(640,root,%{zmgid_final}) /etc/zm/zm.conf %config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf %config(noreplace) /etc/tmpfiles.d/zoneminder.conf %config(noreplace) /etc/logrotate.d/zoneminder diff --git a/distros/fedora/zoneminder.f22.spec b/distros/fedora/zoneminder.f22.spec new file mode 100644 index 000000000..8e98f3693 --- /dev/null +++ b/distros/fedora/zoneminder.f22.spec @@ -0,0 +1,409 @@ +%define zmuid $(id -un) +%define zmgid $(id -gn) +%define zmuid_final apache +%define zmgid_final apache + +%global _hardened_build 1 + +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + +Name: zoneminder +Version: 1.28.1 +Release: 1%{?dist} +Summary: A camera monitoring and analysis tool +Group: System Environment/Daemons +# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/ +# Mootools is inder the MIT license: http://mootools.net/ +License: GPLv2+ and LGPLv2+ and MIT +URL: http://www.zoneminder.com/ + +#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz +Source: ZoneMinder-%{version}.tar.gz + +BuildRequires: cmake gnutls-devel systemd-units bzip2-devel +BuildRequires: mariadb-devel pcre-devel libjpeg-turbo-devel +BuildRequires: perl(Archive::Tar) perl(Archive::Zip) perl-podlators +BuildRequires: perl(Date::Manip) perl(DBD::mysql) +BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) +BuildRequires: perl(MIME::Entity) perl(MIME::Lite) +BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) +BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) +BuildRequires: perl(Expect) perl(Sys::Syslog) +BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel libv4l-devel +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} +# cmake needs the following installed at build time due to the way it auto-detects certain parameters +BuildRequires: httpd polkit-devel +%{!?_without_ffmpeg:BuildRequires: ffmpeg} + +Requires: httpd php php-gd php-mysql cambozola polkit net-tools psmisc +Requires: libjpeg-turbo vlc-core libcurl +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) +Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) +Requires: perl(LWP::Protocol::https) +%{!?_without_ffmpeg:Requires: ffmpeg} + +Requires(post): systemd-units systemd-sysv +Requires(post): /usr/bin/gpasswd +Requires(post): /usr/bin/less +Requires(preun): systemd-units +Requires(postun): systemd-units + +%description +ZoneMinder is a set of applications which is intended to provide a complete +solution allowing you to capture, analyse, record and monitor any cameras you +have attached to a Linux based machine. It is designed to run on kernels which +support the Video For Linux (V4L) interface and has been tested with cameras +attached to BTTV cards, various USB cameras and IP network cameras. It is +designed to support as many cameras as you can attach to your computer without +too much degradation of performance. + +%prep +%setup -q -n ZoneMinder-%{version} + +# Change the following default values +./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin/zm/nph-zms +./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes +./utils/zmeditconfigdata.sh ZM_PATH_SWAP /dev/shm +./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR /var/spool/zoneminder-upload +./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes +./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no +./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no + +%build +%cmake \ + -DZM_TARGET_DISTRO="f22" \ +%{?_without_ffmpeg:-DZM_NO_FFMPEG=ON} \ +%{?_without_x10:-DZM_NO_X10=ON} \ + . + +make %{?_smp_mflags} + +%install +export DESTDIR=%{buildroot} +make install + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout + +# Upgrade from a previous version of zoneminder +if [ $1 -eq 2 ] ; then + # Freshen the database + /usr/bin/zmupdate.pl -f + + # We can't run this automatically when new sql account permissions need to + # be manually added first + # Run zmupdate non-interactively + #/usr/bin/zmupdate.pl --nointeractive +fi + +# Warn the end user to read the README file +echo -e "\nVERY IMPORTANT: Before starting ZoneMinder, read README.Fedora to finish the\ninstallation or upgrade!\n" +echo -e "\nThe README file is located here: %{_docdir}/%{name}\n" + +%preun +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || : + /bin/systemctl stop zoneminder.service > /dev/null 2>&1 || : +fi + +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : +fi + +%triggerun -- zoneminder < 1.25.0-4 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply zoneminder +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save zoneminder >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del zoneminder >/dev/null 2>&1 || : +/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : + + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING README.md distros/fedora/README.Fedora distros/fedora/jscalendar-doc +%config %attr(640,root,%{zmgid_final}) /etc/zm/zm.conf +%config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf +%config(noreplace) /etc/tmpfiles.d/zoneminder.conf +%config(noreplace) /etc/logrotate.d/zoneminder + +%{_unitdir}/zoneminder.service + +%{_bindir}/zma +%{_bindir}/zmaudit.pl +%{_bindir}/zmc +%{_bindir}/zmcontrol.pl +%{_bindir}/zmdc.pl +%{_bindir}/zmf +%{_bindir}/zmfilter.pl +%{_bindir}/zmpkg.pl +%{_bindir}/zmstreamer +%{_bindir}/zmtrack.pl +%{_bindir}/zmtrigger.pl +%{_bindir}/zmu +%{_bindir}/zmupdate.pl +%{_bindir}/zmvideo.pl +%{_bindir}/zmwatch.pl +%{_bindir}/zmcamtool.pl +%{_bindir}/zmsystemctl.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} + +%{perl_vendorlib}/ZoneMinder* +%{_mandir}/man*/* +%dir %{_libexecdir}/zoneminder +%{_libexecdir}/zoneminder/cgi-bin +%dir %{_datadir}/zoneminder +%{_datadir}/zoneminder/db +%{_datadir}/zoneminder/www + +%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy +%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules + +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/events +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/images +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/sock +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/swap +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/temp +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/log/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/spool/zoneminder-upload +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /run/zoneminder + + +%changelog +* Sat Feb 14 2015 Andrew Bauer - 1.28.1 +- Bump version for 1.28.1 release on Fedora 21. + +* Sun Oct 5 2014 Andrew Bauer - 1.28.0 +- Bump version for 1.28.0 release. + +* Fri Mar 14 2014 Andrew Bauer - 1.27 +- Tweak build requirements for cmake + +* Sat Feb 01 2014 Andrew Bauer - 1.27 +- Add zmcamtool.pl. Bump version for 1.27 release. + +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + +* Mon Oct 07 2013 Andrew Bauer - 1.26.4 +- Initial cmake build. + +* Sat Oct 05 2013 Andrew Bauer - 1.26.4 +- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch +- All files are now part of the zoneminder source tree. Update specfile accordingly. + +* Sat Sep 21 2013 Andrew Bauer - 1.26.3 +- Initial rebuild for ZoneMinder 1.26.3 release. + +* Fri Feb 15 2013 Fedora Release Engineering - 1.25.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Adam Tkac - 1.25.0-12 +- rebuild due to "jpeg8-ABI" feature drop + +* Mon Jan 7 2013 Remi Collet - 1.25.0-11 +- fix configuration file for httpd 2.4, #871502 + +* Fri Dec 21 2012 Adam Tkac - 1.25.0-10 +- rebuild against new libjpeg + +* Thu Aug 09 2012 Jason L Tibbitts III - 1.25.0-9 +- Add patch to work around v4l2 api breakage in 3.5 kernel. + +* Sun Jul 22 2012 Fedora Release Engineering - 1.25.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jun 23 2012 Petr Pisar - 1.25.0-7 +- Perl 5.16 rebuild + +* Wed Mar 21 2012 Jason L Tibbitts III - 1.25.0-6 +- Fix stupid thinko in sql modifications. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-5 +- Clean up macro usage. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-4 +- Convert to systemd. +- Add tmpfiles.d configuration since the initscript isn't around to create + /run/zoneminder. +- Remove some pointless executable permissions. +- Add logrotate file. + +* Wed Feb 22 2012 Jason L Tibbitts III - 1.25.0-3 +- Update README.Fedora to reference systemctl and mention timezone info in + php.ini. +- Add proper default for EYEZM_LOG_TO_FILE. + + +* Thu Feb 09 2012 Jason L Tibbitts III - 1.25.0-2 +- Rebuild for new pcre. + +* Thu Jan 19 2012 Jason L Tibbitts III - 1.25.0-1 +- Update to 1.25.0 +- Fix gcc4.7 build problems. +- Drop gcc4.4 build fixes; for whatever reason they now break the build. +- Clean up old patches. +- Force setting of ZM_TMPDIR and ZM_RUNDIR. + +* Sat Jan 14 2012 Fedora Release Engineering - 1.24.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-3 +- Re-add the dist-tag that somehow got lost. + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-2 +- Add patch for bug 711780 - fix syntax issue in Mapped.pm. +- Undo that patch, and undo another which was the cause of the whole mess. +- Fix up other patches so ZM_PATH_BUILD is both defined and useful. +- Make sure database creation mods actually take. +- Update Fedora-specific docs with some additional info. +- Use bundled mootools (javascript, so no guideline violation). +- Update download location. +- Update the gcrypt patch to actually work. +- Upstream changed the tarball without changing the version to patch a + vulnerability, so redownload. + +* Sun Aug 14 2011 Jason L Tibbitts III - 1.24.4-1 +- Initial attempt to upgrade to 1.24.4. +- Add patch from BZ 460310 to build against libgcrypt instead of requiring the + gnutls openssl libs. + +* Thu Jul 21 2011 Petr Sabata - 1.24.3-7.20110324svn3310 +- Perl mass rebuild + +* Wed Jul 20 2011 Petr Sabata - 1.24.3-6.20110324svn3310 +- Perl mass rebuild + +* Mon May 09 2011 Jason L Tibbitts III - 1.24.3-5.20110324svn3310 +- Bump for gnutls update. + +* Thu Mar 24 2011 Jason L Tibbitts III - 1.24.3-4.20110324svn3310 +- Update to latest 1.24.3 subversion. Turns out that what upstream was calling + 1.24.3 is really just an occasionally updated devel snapshot. +- Rebase various patches. + +* Wed Mar 23 2011 Dan Horák - 1.24.3-3 +- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.24.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jan 25 2011 Jason L Tibbitts III - 1.24.3-1 +- Update to latest upstream version. +- Rebase patches. +- Initial incomplete attempt to disable v4l1 support. + +* Fri Jan 21 2011 Jason L Tibbitts III - 1.24.2-6 +- Unbundle cambozola; instead link to the separately pacakged copy. +- Remove BuildRoot:, %%clean and buildroot cleaning in %%install. +- Git rid of mixed space/tab usage by removing all tabs. +- Remove unnecessary Conflicts: line. +- Attempt to force short_open_tag on for the code directories. +- Move default location of sockets, swaps, logfiles and some temporary files to + make more sense and allow things to work better with a future selinux policy. +- Fix errors in README.Fedora. + +* Wed Jun 02 2010 Marcela Maslanova - 1.24.2-5 +- Mass rebuild with perl-5.12.0 + +* Fri Dec 4 2009 Stepan Kasal - 1.24.2-4 +- rebuild against perl 5.10.1 +- use Perl vendorarch and archlib variables correctly + +* Mon Jul 27 2009 Fedora Release Engineering - 1.24.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-2 +- Bump release since 1.24.2-1 was mistakenly tagged a few months ago. + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-1 +- Initial update to 1.24.2. +- Rebase patches. +- Update mootools download location. +- Update to mootools 1.2.3. +- Add additional dependencies for some optional features. + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-3 +- Remove unused Sys::Mmap perl dependency RPM is finding + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-2 +- Update gcc44 patch to disable -frepo, seems to be broken with gcc44 +- Added noffmpeg patch to make building outside mock easier + +* Sat Mar 21 2009 Martin Ebourne - 1.24.1-1 +- Patch for gcc 4.4 compilation errors +- Upgrade to 1.24.1 + +* Wed Feb 25 2009 Fedora Release Engineering - 1.23.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Jan 24 2009 Caolán McNamara - 1.23.3-3 +- rebuild for dependencies + +* Mon Dec 15 2008 Martin Ebourne - 1.23.3-2 +- Fix permissions on zm.conf + +* Fri Jul 11 2008 Jason L Tibbitts III - 1.23.3-1 +- Initial attempt at packaging 1.23. + +* Tue Jul 1 2008 Martin Ebourne - 1.22.3-15 +- Add perl module compat dependency, bz #453590 + +* Tue May 6 2008 Martin Ebourne - 1.22.3-14 +- Remove default runlevel, bz #441315 + +* Mon Apr 28 2008 Jason L Tibbitts III - 1.22.3-13 +- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3. + +* Tue Feb 19 2008 Fedora Release Engineering - 1.22.3-12 +- Autorebuild for GCC 4.3 + +* Thu Jan 3 2008 Martin Ebourne - 1.22.3-11 +- Fix compilation on gcc 4.3 + +* Thu Dec 6 2007 Martin Ebourne - 1.22.3-10 +- Rebuild for new openssl + +* Thu Aug 2 2007 Martin Ebourne - 1.22.3-8 +- Fix licence tag + +* Thu Jul 12 2007 Martin Ebourne - 1.22.3-7 +- Fixes from testing by Jitz including missing dependencies and database creation + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-6 +- Disable crashtrace on ppc + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-5 +- Fix uid for directories in /var/lib/zoneminder + +* Tue Jun 26 2007 Martin Ebourne - 1.22.3-4 +- Added perl Archive::Tar dependency +- Disabled web interface due to lack of access control on the event images + +* Sun Jun 10 2007 Martin Ebourne - 1.22.3-3 +- Changes recommended in review by Jason Tibbitts + +* Mon Apr 2 2007 Martin Ebourne - 1.22.3-2 +- Standardised on package name of zoneminder + +* Thu Dec 28 2006 Martin Ebourne - 1.22.3-1 +- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin diff --git a/distros/fedora/zoneminder.logrotate.in b/distros/fedora/zoneminder.logrotate.in new file mode 120000 index 000000000..c7e334ca4 --- /dev/null +++ b/distros/fedora/zoneminder.logrotate.in @@ -0,0 +1 @@ +../redhat/zoneminder.el7.logrotate.in \ No newline at end of file diff --git a/distros/fedora/zoneminder.service.in b/distros/fedora/zoneminder.service.in new file mode 100644 index 000000000..8c6214b42 --- /dev/null +++ b/distros/fedora/zoneminder.service.in @@ -0,0 +1,18 @@ +# ZoneMinder systemd unit file for Fedora +# Replace mariadb with community-mysql if using mysql service instead of mariadb + +[Unit] +Description=ZoneMinder CCTV recording and security system +After=network.target mariadb.service httpd.service +Requires=mariadb.service httpd.service + +[Service] +User=@WEB_USER@ +Type=forking +ExecStart=@BINDIR@/zmpkg.pl start +ExecReload=@BINDIR@/zmpkg.pl restart +ExecStop=@BINDIR@/zmpkg.pl stop +PIDFile="@ZM_RUNDIR@/zm.pid" + +[Install] +WantedBy=multi-user.target diff --git a/distros/fedora/zoneminder.tmpfiles.in b/distros/fedora/zoneminder.tmpfiles.in new file mode 120000 index 000000000..0e4f721f6 --- /dev/null +++ b/distros/fedora/zoneminder.tmpfiles.in @@ -0,0 +1 @@ +../redhat/zoneminder.tmpfiles.in \ No newline at end of file diff --git a/distros/redhat/zoneminder.el7.spec b/distros/redhat/zoneminder.el7.spec index f283c6a3c..6ed7510b0 100644 --- a/distros/redhat/zoneminder.el7.spec +++ b/distros/redhat/zoneminder.el7.spec @@ -114,8 +114,8 @@ if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || : /bin/systemctl stop zoneminder.service > /dev/null 2>&1 || : - echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n" - /usr/sbin/semodule -r local_zoneminder.pp +# echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n" +# /usr/sbin/semodule -r local_zoneminder.pp fi %postun diff --git a/distros/redhat/zoneminder.tmpfiles.in b/distros/redhat/zoneminder.tmpfiles.in index 8f55ce295..f655a9c9f 100644 --- a/distros/redhat/zoneminder.tmpfiles.in +++ b/distros/redhat/zoneminder.tmpfiles.in @@ -1 +1,3 @@ -d @ZM_RUNDIR@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_RUNDIR@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_TMPDIR@ 0755 @WEB_USER@ @WEB_GROUP@ +D @ZM_SOCKDIR@ 0755 @WEB_USER@ @WEB_GROUP@ diff --git a/distros/ubuntu1204/init.d b/distros/ubuntu1204/init.d index d3354c1d8..f22143c38 100644 --- a/distros/ubuntu1204/init.d +++ b/distros/ubuntu1204/init.d @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p $RUNDIR && chown www-data:www-data $RUNDIR mkdir -p $TMPDIR && chown www-data:www-data $TMPDIR $command start diff --git a/distros/ubuntu1204_cmake/zoneminder.init b/distros/ubuntu1204_cmake/zoneminder.init index 88de7cef9..5cdf62165 100644 --- a/distros/ubuntu1204_cmake/zoneminder.init +++ b/distros/ubuntu1204_cmake/zoneminder.init @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p "$RUNDIR" && chown www-data:www-data "$RUNDIR" mkdir -p "$TMPDIR" && chown www-data:www-data "$TMPDIR" $command start diff --git a/distros/ubuntu1504/apache.conf b/distros/ubuntu1504/apache.conf index 92a2b6414..30a3774ac 100644 --- a/distros/ubuntu1504/apache.conf +++ b/distros/ubuntu1504/apache.conf @@ -1,4 +1,4 @@ -Alias /zm /usr/share/zoneminder +Alias /zm /usr/share/zoneminder/www php_flag register_globals off diff --git a/distros/ubuntu1504/links b/distros/ubuntu1504/links index 9715ee428..2de75e323 100644 --- a/distros/ubuntu1504/links +++ b/distros/ubuntu1504/links @@ -1,4 +1,4 @@ -var/cache/zoneminder/events usr/share/zoneminder/events -var/cache/zoneminder/images usr/share/zoneminder/images -var/cache/zoneminder/temp usr/share/zoneminder/temp -usr/lib/cgi-bin usr/share/zoneminder/cgi-bin +var/cache/zoneminder/events usr/share/zoneminder/www/events +var/cache/zoneminder/images usr/share/zoneminder/www/images +var/cache/zoneminder/temp usr/share/zoneminder/www/temp +usr/lib/cgi-bin usr/lib/zoneminder/cgi-bin diff --git a/distros/ubuntu1504/preinst b/distros/ubuntu1504/preinst index 6cd01ba55..6332f521d 100755 --- a/distros/ubuntu1504/preinst +++ b/distros/ubuntu1504/preinst @@ -3,15 +3,15 @@ set -e abort=false -if [ -L /usr/share/zoneminder/events ]; then - l=$(readlink /usr/share/zoneminder/events) - if [ "$l" != "/var/cache/zoneminder/events" ]; then +if [ -L /usr/share/zoneminder/www/events ]; then + l=$(readlink /usr/share/zoneminder/www/events) + if [ "$l" != "/var/cache/zoneminder/www/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 +if [ -L /usr/share/zoneminder/www/images ]; then + l=$(readlink /usr/share/zoneminder/www/images ) + if [ "$l" != "/var/cache/zoneminder/www/images" ]; then abort=true fi fi @@ -19,9 +19,9 @@ 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 +/usr/share/zoneminder/www 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. +/var/cache/zoneminder/www before installing zoneminder from the package. EOF exit 1 diff --git a/distros/ubuntu1504/rules b/distros/ubuntu1504/rules index 280d5faef..9fe5e92d8 100755 --- a/distros/ubuntu1504/rules +++ b/distros/ubuntu1504/rules @@ -40,12 +40,12 @@ override_dh_install: # # NOTE: This is a short-term kludge; hopefully changes in the next # upstream version will render this unnecessary. - rm -rf debian/zoneminder/usr/share/zoneminder/events - rm -rf debian/zoneminder/usr/share/zoneminder/images + rm -rf debian/zoneminder/usr/share/zoneminder/www/events + rm -rf debian/zoneminder/usr/share/zoneminder/www/images rm -rf debian/zoneminder/usr/share/zoneminder/temp - dh_link var/cache/zoneminder/events usr/share/zoneminder/events - dh_link var/cache/zoneminder/images usr/share/zoneminder/images - dh_link var/cache/zoneminder/temp usr/share/zoneminder/temp + dh_link var/cache/zoneminder/events usr/share/zoneminder/www/events + dh_link var/cache/zoneminder/images usr/share/zoneminder/www/images + dh_link var/cache/zoneminder/temp usr/share/zoneminder/www/temp # # This is a slightly lesser kludge; moving the cgi stuff to @@ -53,7 +53,7 @@ override_dh_install: # having it just in /usr/lib/cgi-bin breaks another bit of # behavior. # - dh_link usr/lib/cgi-bin usr/share/zoneminder/cgi-bin + dh_link usr/lib/cgi-bin usr/lib/zoneminder/cgi-bin override_dh_fixperms: dh_fixperms diff --git a/distros/ubuntu1504_cmake/zoneminder.init b/distros/ubuntu1504_cmake/zoneminder.init index 88de7cef9..5cdf62165 100644 --- a/distros/ubuntu1504_cmake/zoneminder.init +++ b/distros/ubuntu1504_cmake/zoneminder.init @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p "$RUNDIR" && chown www-data:www-data "$RUNDIR" mkdir -p "$TMPDIR" && chown www-data:www-data "$TMPDIR" $command start diff --git a/distros/ubuntu1504_cmake_split_packages/zoneminder-core.zoneminder.init b/distros/ubuntu1504_cmake_split_packages/zoneminder-core.zoneminder.init index d3354c1d8..f22143c38 100644 --- a/distros/ubuntu1504_cmake_split_packages/zoneminder-core.zoneminder.init +++ b/distros/ubuntu1504_cmake_split_packages/zoneminder-core.zoneminder.init @@ -23,6 +23,7 @@ command="$ZM_PATH_BIN/zmpkg.pl" start() { echo -n "Starting $prog: " + export TZ=:/etc/localtime mkdir -p $RUNDIR && chown www-data:www-data $RUNDIR mkdir -p $TMPDIR && chown www-data:www-data $TMPDIR $command start diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index 7a74303fc..bdd92524b 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -126,16 +126,25 @@ MAIN: while( $loop ) { while ( ! ( $dbh and $dbh->ping() ) ) { $dbh = zmDbConnect(); - last if $dbh; - if ( $continuous ) { - # if we are running continuously, then just skip to the next - # interval, otherwise we are a one off run, so wait a second and - # retry until someone kills us. - sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ); - } else { - sleep 1; - } # end if - } # end while can't connect to the db + if ( $continuous ) { + Error("Unable to connect to database"); + # if we are running continuously, then just skip to the next + # interval, otherwise we are a one off run, so wait a second and + # retry until someone kills us. + sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ); + } else { + Fatal("Unable to connect to database"); + } # end if + } # end while can't connect to the db + + if ( $continuous ) { + # if we are running continuously, then just skip to the next + # interval, otherwise we are a one off run, so wait a second and + # retry until someone kills us. + sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ); + } else { + sleep 1; + } # end if if ( ! exists $Config{ZM_AUDIT_MIN_AGE} ) { Fatal("ZM_AUDIT_MIN_AGE is not set in config."); @@ -366,7 +375,7 @@ MAIN: while( $loop ) { # Remove empty events (with no frames) $cleaned = 0; - my $selectEmptyEventsSql = "SELECT * FROM Events as E LEFT JOIN Frames as F ON (E.Id = F.EventId) + my $selectEmptyEventsSql = "SELECT E.Id AS Id, E.StartTime, F.EventId FROM Events as E LEFT JOIN Frames as F ON (E.Id = F.EventId) WHERE isnull(F.EventId) AND now() - interval ".$Config{ZM_AUDIT_MIN_AGE}." second > E.StartTime"; my $selectEmptyEventsSth = $dbh->prepare_cached( $selectEmptyEventsSql ) or Fatal( "Can't prepare '$selectEmptyEventsSql': ".$dbh->errstr() ); diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index 19ada2678..6fbc7acd7 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -50,6 +50,7 @@ configuring upgrades etc, including on the fly upgrades. =cut use strict; use bytes; +use version; # ========================================================================== # @@ -1027,16 +1028,23 @@ if ( $version ) my @files; $updateDir = $Config{ZM_PATH_DATA}."/db" if ! $updateDir; opendir( my $dh, $updateDir ) || die "Can't open updateDir $!"; - @files = sort grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh); + #@files = sort grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh); + #PP - use perl version sort + @files = sort { + my ($x) = ($a =~ m/^zm_update\-(.*)\.sql$/); + my ($y) = ($b =~ m/^zm_update\-(.*)\.sql$/); + version->parse($x) <=> version->parse($y) + } grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh); closedir $dh; - if ( ! @files ) { - die "Should have found upgrade scripts at $updateDir\n"; - } # end if + if ( ! @files ) { + die "Should have found upgrade scripts at $updateDir\n"; + } # end if $dbh->{'AutoCommit'} = 0; foreach my $patch ( @files ) { my ( $v ) = $patch =~ /^zm_update\-([\d\.]+)\.sql$/; - if ( $v ge $version ) { + #PP make sure we use version compare + if ( version->parse($v) ge version->parse($version) ) { print( "Upgrading DB to $v from $version\n" ); patchDB( $dbh, $v ); if ( $dbh->errstr() ) { diff --git a/web/index.php b/web/index.php index 4b9ab3409..70e177aaf 100644 --- a/web/index.php +++ b/web/index.php @@ -60,6 +60,12 @@ else define( "ZM_BASE_PROTOCOL", $protocol ); define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] ); +// Check time zone is set +if (!ini_get('date.timezone') || !date_default_timezone_set(ini_get('date.timezone'))) { + date_default_timezone_set('UTC'); + Fatal( "ZoneMinder is not installed properly: php's date.timezone is not set to a valid timezone" ); +} + if ( isset($_GET['skin']) ) $skin = $_GET['skin']; elseif ( isset($_COOKIE['zmSkin']) ) @@ -125,6 +131,12 @@ else require_once( 'includes/lang.php' ); require_once( 'includes/functions.php' ); +// Check for valid content dirs +if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) +{ + Fatal( "Cannot write to content dirs('".ZM_DIR_EVENTS."','".ZM_DIR_IMAGES."'). Check that these exist and are owned by the web account user"); +} + if ( isset($_REQUEST['view']) ) $view = detaintPath($_REQUEST['view']); diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 915972d10..647ae132c 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -287,15 +287,16 @@ foreach( $displayMonitors as $monitor ) $dclass = "errorText"; else { - if ( !$monitor['zma'] ) + // https://github.com/ZoneMinder/ZoneMinder/issues/1082 + if ( !$monitor['zma'] && $monitor['Function']!='Monitor' ) $dclass = "warnText"; else $dclass = "infoText"; } if ( $monitor['Function'] == 'None' ) $fclass = "errorText"; - elseif ( $monitor['Function'] == 'Monitor' ) - $fclass = "warnText"; + //elseif ( $monitor['Function'] == 'Monitor' ) + // $fclass = "warnText"; else $fclass = "infoText"; if ( !$monitor['Enabled'] )