Skip to content

Commit

Permalink
Merge branch 'master' into storageareas
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Apr 12, 2017
2 parents 51d5bfc + e28be26 commit d039227
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ADD utils/docker/start.sh /tmp/start.sh
RUN chown -R www-data:www-data /usr/local/share/zoneminder/

# Adding apache virtual hosts file
ADD utils/docker/apache-vhost /etc/apache2/sites-available/000-default.conf
RUN cp misc/apache.conf /etc/apache2/sites-available/000-default.conf
ADD utils/docker/phpdate.ini /etc/php5/apache2/conf.d/25-phpdate.ini

# Expose http ports
Expand Down
5 changes: 4 additions & 1 deletion distros/redhat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ else("${unzip_jsc}" STREQUAL "")
endif("${unzip_jsc}" STREQUAL "")

# Create several empty folders
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp logs cache models persistent views)

# Install the empty folders
install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY events images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY logs cache DESTINATION /var/lib/zoneminder/temp DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY models persistent views DESTINATION /var/lib/zoneminder/temp/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

# Create symlinks
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/events \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/events\")")
Expand Down
13 changes: 10 additions & 3 deletions distros/redhat/zoneminder.spec
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ too much degradation of performance.
%prep
%autosetup -n ZoneMinder-%{version}
%autosetup -a 1 -n ZoneMinder-%{version}
rmdir ./web/api/app/Plugin/Crud
mv -f crud-%{crud_version} ./web/api/app/Plugin/Crud
%{__rm} -rf ./web/api/app/Plugin/Crud
%{__mv} -f crud-%{crud_version} ./web/api/app/Plugin/Crud

# Change the following default values
./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin-zm/nph-zms
Expand Down Expand Up @@ -333,7 +333,14 @@ rm -rf %{_docdir}/%{name}-%{version}
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %ghost %{_localstatedir}/run/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/run/zoneminder

# cakephp requires its cache folders to pre-exist
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp/logs
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp/cache
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp/cache/views
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp/cache/models
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp/cache/persistent

%changelog
* Thu Mar 30 2017 Andrew Bauer <[email protected]> - 1.30.2-2
Expand Down
4 changes: 4 additions & 0 deletions distros/ubuntu1204/zoneminder.tmpfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
d /var/run/zm 0755 www-data www-data
d /tmp/zm 0755 www-data www-data
d /var/tmp/zm 0755 www-data www-data
d /var/tmp/cache 0755 www-data www-data
d /var/tmp/cache/models 0755 www-data www-data
d /var/tmp/cache/persistent 0755 www-data www-data
2 changes: 1 addition & 1 deletion distros/ubuntu1604/source/format
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0
3.0 (native)
15 changes: 7 additions & 8 deletions docs/installationguide/redhat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ Now clone the ZoneMinder git repository:
cd
git clone https://github.com/ZoneMinder/ZoneMinder
cd ZoneMinder
git submodule init
git submodule update

This will create a sub-folder called ZoneMinder, which will contain the latest development.

Expand All @@ -180,21 +178,22 @@ We want to turn this into a tarball, but first we need to figure out what to nam

ls ~/rpmbuild/SOURCES

The tarball from the previsouly installed SRPM should be there. This is the name we will use. For this example, the name is ZoneMinder-1.28.1.tar.gz. From one folder above the local ZoneMinder git repository, execute the following:
The tarball from the previsouly installed SRPM should be there. This is the name we will use. For this example, the name is ZoneMinder-1.28.1.tar.gz. From the local ZoneMinder git repository, execute the following:

::

mv ZoneMinder ZoneMinder-1.28.1
tar -cvzf ~/rpmbuild/SOURCES/ZoneMinder-1.28.1.tar.gz ZoneMinder-1.28.1/*
git archive --prefix=ZoneMinder-1.28.1/ -o zoneminder-1.28.1.tar.gz HEAD
mv zoneminder-1.28.1.tar.gz ~/rpmbuld/SOURCES/

The trailing "/\*" leaves off the hidden dot "." file and folders from the git repo, which is what we want.
Note that we are overwriting the original tarball. If you wish to keep the original tarball then create a copy prior to creating the new tarball.

Now build a new src.rpm:
From the root of the local ZoneMinder git repo, execute the following:

::

rpmbuild -bs --nodeps ~/rpmbuild/SPECS/zoneminder.el7.spec
rpmbuild -bs --nodeps distros/redhat/zoneminder.spec

Notice we used the rpm specfile that is part of the latest master branch you just downloaded, rather than the one that may be in your ~/rpmbbuild/SOURCES folder.

This step will overwrite the SRPM you originally downloaded, so you may want to back it up prior to completing this step. Note that the name of the specfile will vary slightly depending on the target distro.

Expand Down
11 changes: 10 additions & 1 deletion misc/apache.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
# Some values may need to manually adjusted to suit your setup
#
<VirtualHost *:80>
ServerName @WEB_HOST@
ServerAdmin webmaster@localhost

DocumentRoot "@WEB_PREFIX@"
Alias /zm/ "@WEB_PREFIX@/"
<Directory "@WEB_PREFIX@">
Options -Indexes +FollowSymLinks
AllowOverride All
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Directory>

ScriptAlias /cgi-bin "@CGI_PREFIX@"
Expand Down
12 changes: 9 additions & 3 deletions scripts/ZoneMinder/lib/ZoneMinder/General.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ sub getCmdFormat {
my $suffix = "";
my $command = $prefix.$null_command.$suffix;
Debug( "Testing \"$command\"\n" );
my $output = qx($command);
my $output = qx($command 2>&1);
my $status = $? >> 8;
$output //= $!;

if ( !$status ) {
Debug( "Test ok, using format \"$prefix<command>$suffix\"\n" );
return( $prefix, $suffix );
Expand All @@ -117,8 +119,10 @@ sub getCmdFormat {
$suffix = "'";
$command = $prefix.$null_command.$suffix;
Debug( "Testing \"$command\"\n" );
my $output = qx($command);
my $output = qx($command 2>&1);
my $status = $? >> 8;
$output //= $!;

if ( !$status ) {
Debug( "Test ok, using format \"$prefix<command>$suffix\"\n" );
return( $prefix, $suffix );
Expand All @@ -130,8 +134,10 @@ sub getCmdFormat {
$suffix = "'";
$command = $prefix.$null_command.$suffix;
Debug( "Testing \"$command\"\n" );
$output = qx($command);
$output = qx($command 2>&1);
$status = $? >> 8;
$output //= $!;

if ( !$status ) {
Debug( "Test ok, using format \"$prefix<command>$suffix\"\n" );
return( $prefix, $suffix );
Expand Down
40 changes: 24 additions & 16 deletions src/zm_local_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ LocalCamera::LocalCamera(
palette = V4L2_PIX_FMT_YUYV;
} else {
if(capture) {
Info("Selected capture palette: %s (%c%c%c%c)", palette_desc, palette&0xff, (palette>>8)&0xff, (palette>>16)&0xff, (palette>>24)&0xff);
Info("Selected capture palette: %s (0x%02hhx%02hhx%02hhx%02hhx)", palette_desc, (palette>>24)&0xff, (palette>>16)&0xff, (palette>>8)&0xff, (palette)&0xff);
}
}
}
Expand Down Expand Up @@ -427,7 +427,8 @@ LocalCamera::LocalCamera(
} else {
if( capture )
#if HAVE_LIBSWSCALE
Info("No direct match for the selected palette (%c%c%c%c) and target colorspace (%d). Format conversion is required, performance penalty expected", (capturePixFormat)&0xff,((capturePixFormat>>8)&0xff),((capturePixFormat>>16)&0xff),((capturePixFormat>>24)&0xff), colours );
Info("No direct match for the selected palette (0x%02hhx%02hhx%02hhx%02hhx) and target colorspace (%02u). Format conversion is required, performance penalty expected",
(capturePixFormat>>24)&0xff,((capturePixFormat>>16)&0xff),((capturePixFormat>>8)&0xff),((capturePixFormat)&0xff), colours);
#else
Info("No direct match for the selected palette and target colorspace. Format conversion is required, performance penalty expected");
#endif
Expand All @@ -445,16 +446,18 @@ LocalCamera::LocalCamera(
subpixelorder = ZM_SUBPIX_ORDER_NONE;
imagePixFormat = AV_PIX_FMT_GRAY8;
} else {
Panic("Unexpected colours: %d",colours);
Panic("Unexpected colours: %u",colours);
}
if( capture ) {
#if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0)
if(!sws_isSupportedInput(capturePixFormat)) {
Error("swscale does not support the used capture format: %c%c%c%c",(capturePixFormat)&0xff,((capturePixFormat>>8)&0xff),((capturePixFormat>>16)&0xff),((capturePixFormat>>24)&0xff));
Error("swscale does not support the used capture format: 0x%02hhx%02hhx%02hhx%02hhx",
(capturePixFormat>>24)&0xff,((capturePixFormat>>16)&0xff),((capturePixFormat>>8)&0xff),((capturePixFormat)&0xff));
conversion_type = 2; /* Try ZM format conversions */
}
if(!sws_isSupportedOutput(imagePixFormat)) {
Error("swscale does not support the target format: %c%c%c%c",(imagePixFormat)&0xff,((imagePixFormat>>8)&0xff),((imagePixFormat>>16)&0xff),((imagePixFormat>>24)&0xff));
Error("swscale does not support the target format: 0x%02hhx%02hhx%02hhx%02hhx",
(imagePixFormat>>24)&0xff,((imagePixFormat>>16)&0xff),((imagePixFormat>>8)&0xff),((imagePixFormat)&0xff));
conversion_type = 2; /* Try ZM format conversions */
}
#endif
Expand Down Expand Up @@ -563,7 +566,7 @@ LocalCamera::LocalCamera(
subpixelorder = ZM_SUBPIX_ORDER_NONE;
imagePixFormat = AV_PIX_FMT_GRAY8;
} else {
Panic("Unexpected colours: %d",colours);
Panic("Unexpected colours: %u",colours);
}
if( capture ) {
if(!sws_isSupportedInput(capturePixFormat)) {
Expand Down Expand Up @@ -631,7 +634,7 @@ LocalCamera::LocalCamera(
#endif // ZM_HAS_V4L1

last_camera = this;
Debug(3,"Selected subpixelorder: %d",subpixelorder);
Debug(3,"Selected subpixelorder: %u",subpixelorder);

#if HAVE_LIBSWSCALE
/* Initialize swscale stuff */
Expand All @@ -650,7 +653,7 @@ LocalCamera::LocalCamera(
int pSize = avpicture_get_size( imagePixFormat, width, height );
#endif
if( (unsigned int)pSize != imagesize) {
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
Fatal("Image size mismatch. Required: %d Available: %u",pSize,imagesize);
}

imgConversionContext = sws_getContext(width, height, capturePixFormat, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL );
Expand Down Expand Up @@ -871,7 +874,7 @@ void LocalCamera::Initialise()
v4l2_data.buffers[i].start = mmap( NULL, vid_buf.length, PROT_READ|PROT_WRITE, MAP_SHARED, vid_fd, vid_buf.m.offset );

if ( v4l2_data.buffers[i].start == MAP_FAILED )
Fatal( "Can't map video buffer %d (%d bytes) to memory: %s(%d)", i, vid_buf.length, strerror(errno), errno );
Fatal( "Can't map video buffer %u (%u bytes) to memory: %s(%d)", i, vid_buf.length, strerror(errno), errno );

#if HAVE_LIBSWSCALE
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
Expand Down Expand Up @@ -1194,9 +1197,10 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) {
/* Got a format. Copy it to the array */
strcpy(fmt_desc[nIndex], (const char*)(fmtinfo.description));
fmt_fcc[nIndex] = fmtinfo.pixelformat;

Debug(6, "Got format: %s (%c%c%c%c) at index %d",fmt_desc[nIndex],fmt_fcc[nIndex]&0xff, (fmt_fcc[nIndex]>>8)&0xff, (fmt_fcc[nIndex]>>16)&0xff, (fmt_fcc[nIndex]>>24)&0xff ,nIndex);


Debug(6, "Got format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %d",
fmt_desc[nIndex], (fmt_fcc[nIndex]>>24)&0xff, (fmt_fcc[nIndex]>>16)&0xff, (fmt_fcc[nIndex]>>8)&0xff, (fmt_fcc[nIndex])&0xff ,nIndex);

/* Proceed to the next index */
memset(&fmtinfo, 0, sizeof(fmtinfo));
fmtinfo.index = ++nIndex;
Expand All @@ -1223,12 +1227,14 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) {
for( unsigned int i=0; i < n_preferedformats && nIndexUsed < 0; i++ ) {
for( unsigned int j=0; j < nIndex; j++ ) {
if( preferedformats[i] == fmt_fcc[j] ) {
Debug(6, "Choosing format: %s (%c%c%c%c) at index %d",fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j);
Debug(6, "Choosing format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u",
fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j);
/* Found a format! */
nIndexUsed = j;
break;
} else {
Debug(6, "No match for format: %s (%c%c%c%c) at index %d",fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j);
Debug(6, "No match for format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u",
fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j);
}
}
}
Expand Down Expand Up @@ -1403,9 +1409,11 @@ bool LocalCamera::GetCurrentSettings( const char *device, char *output, int vers
}
}
if ( verbose )
sprintf( output+strlen(output), " %s (%c%c%c%c)\n", format.description, format.pixelformat&0xff, (format.pixelformat>>8)&0xff, (format.pixelformat>>16)&0xff, (format.pixelformat>>24)&0xff );
sprintf( output+strlen(output), " %s (0x%02hhx%02hhx%02hhx%02hhx)\n",
format.description, (format.pixelformat>>24)&0xff, (format.pixelformat>>16)&0xff, (format.pixelformat>>8)&0xff, format.pixelformat&0xff);
else
sprintf( output+strlen(output), "%c%c%c%c/", format.pixelformat&0xff, (format.pixelformat>>8)&0xff, (format.pixelformat>>16)&0xff, (format.pixelformat>>24)&0xff );
sprintf( output+strlen(output), "0x%02hhx%02hhx%02hhx%02hhx/",
(format.pixelformat>>24)&0xff, (format.pixelformat>>16)&0xff, (format.pixelformat>>8)&0xff, (format.pixelformat)&0xff);
}
while ( formatIndex++ >= 0 );
if ( !verbose )
Expand Down
14 changes: 0 additions & 14 deletions utils/docker/apache-vhost

This file was deleted.

3 changes: 3 additions & 0 deletions utils/docker/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ mysql -u root < db/zm_create.sql
# Add the ZoneMinder DB user
mysql -u root -e "grant insert,select,update,delete,lock tables,alter on zm.* to 'zmuser'@'localhost' identified by 'zmpass';"

# Make ZM_LOGDIR
mkdir /var/log/zm

# Activate CGI
a2enmod cgi

Expand Down
4 changes: 1 addition & 3 deletions web/skins/classic/views/montagereview.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@
// This program only calls itself with the time range involved -- it does all monitors (the user can see, in the called group) all the time

if ( ! empty( $user['MonitorIds'] ) ) {
$monFilterSql = ' AND M.Id IN ('.$user['MonitorIds'].')';

$eventsSql .= $monFilterSql;
$eventsSql .= ' AND M.Id IN ('.$user['MonitorIds'].')';
$monitorsSql .= ' AND Id IN ('.$user['MonitorIds'].')';
$frameSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')';
}
Expand Down

0 comments on commit d039227

Please sign in to comment.