Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

This commit is contained in:
Isaac Connor 2014-03-28 10:12:39 -04:00
commit 3212974bdf
6 changed files with 143 additions and 110 deletions

View File

@ -67,7 +67,23 @@ set(ZM_NO_CURL "OFF" CACHE BOOL "Set to ON to skip cURL checks and force buildin
set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. default: OFF")
set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib, default: <libdir>/perl5")
set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>")
set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6")
set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6, OS13")
# Reassign some variables if a target distro has been specified
if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
set(ZM_RUNDIR "/var/run/zoneminder")
set(ZM_TMPDIR "/var/lib/zoneminder/temp")
set(ZM_LOGDIR "/var/log/zoneminder")
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
set(ZM_RUNDIR "/var/run/zoneminder")
set(ZM_TMPDIR "/var/run/zoneminder")
set(ZM_CONTENTDIR "/var/run/zoneminder")
set(ZM_LOGDIR "/var/log/zoneminder")
set(ZM_WEB_USER "wwwrun")
set(ZM_WEB_GROUP "www")
set(ZM_WEBDIR "/srv/www/htdocs/zoneminder")
set(ZM_CGIDIR "/srv/www/cgi-bin")
endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
# Required for certain checks to work
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
@ -475,13 +491,6 @@ set(WEB_GROUP "${ZM_WEB_GROUP}")
set(ZM_DB_TYPE "mysql")
set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';")
# Reassign some variables if a target distro has been specified
if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
set(ZM_RUNDIR "/var/run/zoneminder")
set(ZM_TMPDIR "/var/lib/zoneminder/temp")
set(ZM_LOGDIR "/var/log/zoneminder")
endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
# Generate files from the .in files
configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY)
configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
@ -499,6 +508,8 @@ if(ZM_TARGET_DISTRO STREQUAL "f19")
add_subdirectory(distros/fedora)
elseif(ZM_TARGET_DISTRO STREQUAL "el6")
add_subdirectory(distros/redhat)
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
add_subdirectory(distros/opensuse)
else(ZM_TARGET_DISTRO STREQUAL "el6")
add_subdirectory(misc)
endif(ZM_TARGET_DISTRO STREQUAL "f19")

View File

@ -1,22 +1,36 @@
OpenSuse Notes
===============
1. OpenSuse, along with other distros, now use systemd for task control.
One of the capabilties of systemd is to use private space for /tmp to reduce
the possibility of cross talk between applications. The default settings
for zoneminder use /tmp for a number of files. When you start/stop
zoneminder from a web page /tmp will be in private space but when the
start/stop script zmpkg.pl is run from a shell it will be looking in the
real /tmp. This can result in two instances of zoneminder running at
the same time.
In order to remove this problem the OpenSuse rpm defaults the temporary
directory to /var/run/zoneminder. For a new install this will not be a
problem but if you use the rpm to upgrade you may have to make database
changes.
Note: the location is held both within the database an explicitly within some
scripts. It is therefore essential that the database conforms to the values
used in the scripts. Please see information in the Upgrades section of this
document.
2. OpenSuse prefers mariadb to mysql. mariadb is a direct replacement for mysql
and all mysql functions work in the same way. These notes assumes that you
are running mariadb.
New installs
============
This needs to be updated for OpenSuse
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:
NOTE: the default database for OpenSuse is mariadb, which is a direct
replacement for mysql
IMPORTANT: mariadb defaults to strict mode of operation which will cause
some zoneminder database writes to fail.
In order to turn this off - which will be for the whole database you will
need to edit /etc/my.cnf and comment out the record
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES .
To install the database issue the following commands as root:
To install the database issue the following commands (as root):
zypper in mariadb
@ -26,6 +40,12 @@ This needs to be updated for OpenSuse
mysql_secure_installation
IMPORTANT: mariadb defaults to strict mode of operation which will cause
some zoneminder database writes to fail. In order to turn this off -
which will be for the whole database - you will need to edit
/etc/my.cnf and comment out the record
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES.
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
@ -63,36 +83,10 @@ This needs to be updated for OpenSuse
for testing, and edit /etc/sysconfig/selinux to disable it at boot time.
7. IMPORTANT: Edit /etc/httpd/conf.d/zoneminder.conf and/or /etc/httpd/conf.
7. Now start the web server (as root):
*********** This needs checking for OpenSuse
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.
Reference: http://httpd.apache.org/docs/2.4/mod/mod_alias.html#order
Bug Report: https://bugzilla.redhat.com/show_bug.cgi?id=973067
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:
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 apache2.service
sudo systemctl start apache2.service
systemctl enable apache2.service
systemctl start apache2.service
9. You should immediately visit http://localhost/zm and secure the system if
it is network facing. To do this:
@ -107,19 +101,16 @@ This needs to be updated for OpenSuse
g) click the admin user and set a password.
h) enable OPT_CONTROL on the Ssytem tab to enable ptz camera control.
10. ************ Check for OpenSuse
10. You should be able to start zoneminder by issuing the commands (as root):
The zoneminder.service file fails at present but the zmpkg.pl script
can be run as root to start zoneminder.
systemctl enable zoneminder
systemctl start zoneminder
If zoneminder fails to start using the service you may also start it
with this command:
sudo zmpkg.pl start
/opt/zoneminder/bin/zmpkg.pl start
To start zoneminder automatically, create /etc/rc.d/rc.local and place the
following inside it:
#!/bin/sh
/usr/bin/zmpkg.pl start
The rc.local file must be made executable.
Upgrades
========
@ -131,29 +122,46 @@ Upgrades
2. Add the mysql ALTER permission to the zmuser account:
mysql -u root -p
grant alter on zm.* to
'zmuser'@localhost identified by 'zmpass';
use zm
grant alter, lock tables on zm.* to 'zmuser'@localhost;
Since this is an upgrade, the assumption is that the zmuser account already
has select, insert, update, and delete permission.
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:
so (as root):
/opt/zoneminder/bin/zmupdate.pl
sudo /opt/zoneminder/bin/zmupdate.pl --version=<from version>
If unsure then run it this way:
sudo zmupdate.pl --user=root --pass=<mysql_root_pwd> --version=<from version>
4. To overcome a problem when applications my use private /tmp space when systemd is used
the OpenSuse rpm has changed the default directory for temporary files from /tmp to
/var/run/zoneminder. Whilst this change is directly inside the scripts, it does not,
at present, change the values held in the database.
You must therefore manually modify the database as follows:
**** needs more information
4. As mentioned in the OpenSuse notes you may need to change database values.
These steps may be run at any time (as root):
stop the current instance of zoneminder - systemctl stop zoneminder
ensure that all zoneminder processes have terminated:
ps -ef|grep zm
if you find any process still running issue a kill -9 for each
mysql -u root
use zm
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_SOCKS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_SOCKS';
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_SWAP';
commit;
exit
You can then restart zoneminder - systemctl start zoneminder

View File

@ -12,18 +12,19 @@
%define webcgi /srv/www/cgi-bin
Name: zoneminder
Version: 1.26.5
Version: 1.27.0
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/
# Mootools is under the MIT license: http://mootools.net/
License: GPLv2+ and LGPLv2+ and MIT
URL: http://www.zoneminder.com/
Source: ZoneMinder-%{version}.tar.gz
Patch1: zoneminder-1.26.5-opensuse.patch
# patch no longer necessary as OpenSuse now in standard build
# Patch1: zoneminder-1.26.5-opensuse.patch
BuildRequires: cmake
BuildRequires: perl-DBI perl-DBD-mysql perl-Date-Manip perl-Sys-Mmap
@ -37,17 +38,17 @@ Requires: php php-mysql
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl-Sys-Mmap perl-Date-Manip perl-DBD-mysql
Requires: perl-Archive-Tar perl-Archive-Zip
# Can't find suitable package for OpenSuse and not sure if needed
#Requires: perl-MIME-Entity perl-Net-SMTP perl-Net-FTP
Requires: perl-MIME-Lite
Requires: perl-LWP-Protocol-https
Requires: perl-MIME-Lite perl-LWP-Protocol-https
# Can't find suitable packages for OpenSuse for
# perl-MIME-Entity perl-Net-SMTP perl-Net-FTP so installing using cpanm
# cpanm needs make
# Am installing perl(MIME::Tools), perl(Net::SMTP) and perl(Net::FTP)
# MIME::Tools provides MIME::Entity
Requires: make cpanm
# can't find systemd-units or systemd-sysv in OpenSuse
#Requires(post): systemd-units systemd-sysv
Requires(post): /usr/bin/gpasswd
Requires(post): /usr/bin/more
#Requires(preun): systemd-units
#Requires(postun): systemd-units
%description
ZoneMinder is a set of applications which is intended to provide a complete
@ -60,14 +61,15 @@ too much degradation of performance.
%prep
%setup -q -n ZoneMinder-%{version}
cp -R /home/makerpm/rpmbuild/SOURCES/opensuse distros
%patch1 -p0 -b .opensuse
# cp and patch no longer necessary as opensuse distro now in standard build from 1.27.0 on
# cp -R /home/makerpm/rpmbuild/SOURCES/opensuse distros
# %patch1 -p0 -b .opensuse
%build
# For OpenSuse 13.1 we need to set DENABLE_MMAP to yes to vercome a problem
# where tthe perl modules don't have shared memory enabled
# where the perl modules don't have shared memory enabled
%cmake \
-DCMAKE_INSTALL_PREFIX=/opt/zoneminder \
-DCMAKE_INSTALL_PREFIX=%{zm_instdir} \
-DZM_TARGET_DISTRO="OS13" \
-DZM_NO_X10=ON \
-DENABLE_MMAP=yes
@ -93,13 +95,22 @@ fi
# Allow zoneminder access to local video sources
/usr/bin/gpasswd -a %zmuid_final video
# Make sure that the temporary directory exists
#mkdir -p %{zm_tmpdir}
# Display the README for post installation instructions
#/usr/bin/less %{_docdir}/%{name}-%{version}/README.OpenSuse
# both less and more scroll straight off the end of the file
/usr/bin/more %{_docdir}/%{name}/README.OpenSuse
# so we'll output info with echo
echo Installing additional perl modules
cpanm MIME::Tools
cpanm Net::SMTP
cpanm Net::FTP
echo \***********************************************
echo \***** For further information
echo \***** please refer to
echo \***** %{_docdir}/%{name}/README.OpenSuse
echo \*****
echo \***********************************************
%preun
if [ $1 -eq 0 ] ; then
@ -139,8 +150,8 @@ fi
%{_unitdir}/zoneminder.service
# not sure why this is necessary but leaving in for compatibility
%attr(4755,root,root) %{zm_rundir}/zmfix
# zmfix removed from zoneminder 1.26.6
# %attr(4755,root,root) %{zm_rundir}/zmfix
%{zm_instdir}
@ -154,6 +165,10 @@ fi
%changelog
* Mon Mar 24 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.27.0
- Update to zm 1.27.0
- Remove patch which brought opensuse into distros as it is now included
* Tue Mar 18 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.26.5
- Latest update for Opensuse 13.1 - work is still in progress
@ -257,7 +272,7 @@ fi
1.24.3 is really just an occasionally updated devel snapshot.
- Rebase various patches.
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
@ -312,7 +327,7 @@ fi
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
- rebuild for dependencies
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2

View File

@ -460,7 +460,7 @@ if ( $version )
}
else
{
print( "\nDatabase successfully upgraded from version $version.\n" );
print( "\nDatabase successfully upgraded to version $version.\n" );
my $sql = "update Config set Value = ? where Name = 'ZM_DYN_DB_VERSION'";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( $version ) or die( "Can't execute: ".$sth->errstr() );

View File

@ -232,11 +232,11 @@ int cURLCamera::Capture( Image &image )
Debug(8,"Got subheader data: %s",subheader_data.c_str());
/* Check the header */
if(subheader.compare(0,content_length_match_len,content_length_match,content_length_match_len) == 0) {
if(strncasecmp(subheader.c_str(),content_length_match,content_length_match_len) == 0) {
/* Found the content-length header */
frame_content_length = atoi(subheader_data.c_str());
Debug(6,"Got content-length subheader: %d",frame_content_length);
} else if(subheader.compare(0,content_type_match_len,content_type_match,content_type_match_len) == 0) {
} else if(strncasecmp(subheader.c_str(),content_type_match,content_type_match_len) == 0) {
/* Found the content-type header */
frame_content_type = subheader_data;
Debug(6,"Got content-type subheader: %s",frame_content_type.c_str());
@ -367,10 +367,10 @@ size_t cURLCamera::header_callback( void *buffer, size_t size, size_t nmemb, voi
const char* multipart_match = "multipart/x-mixed-replace";
const char* image_jpeg_match = "image/jpeg";
if(content_type.compare(0, strlen(multipart_match), multipart_match) == 0) {
if(strncasecmp(content_type.c_str(),multipart_match,strlen(multipart_match)) == 0) {
Debug(7,"Content type matched as multipart/x-mixed-replace");
mode = MODE_STREAM;
} else if(content_type.compare(0, strlen(image_jpeg_match), image_jpeg_match) == 0) {
} else if(strncasecmp(content_type.c_str(),image_jpeg_match,strlen(image_jpeg_match)) == 0) {
Debug(7,"Content type matched as image/jpeg");
mode = MODE_SINGLE;
}

View File

@ -1168,10 +1168,9 @@ void EventStream::checkEventLoaded()
loadEventData( event_id );
Debug( 2, "Current frame id = %d", curr_frame_id );
// When loading a new event, always set the current frame id to the first frame rather than the last
// if ( curr_frame_id <= 0 )
// curr_frame_id = event_data->frame_count;
// else
if ( curr_frame_id <= 0 )
curr_frame_id = event_data->frame_count;
else
curr_frame_id = 1;
Debug( 2, "New frame id = %d", curr_frame_id );
}