Skip to content

Commit

Permalink
full systemd support
Browse files Browse the repository at this point in the history
  • Loading branch information
knight-of-ni committed Aug 10, 2014
1 parent 7cbb079 commit 1e8e710
Show file tree
Hide file tree
Showing 19 changed files with 331 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ compiler:
- gcc
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq zlib1g-dev apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf cmake libjpeg-turbo8-dev apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
- sudo apt-get install -y -qq libpolkit-gobject-1-dev zlib1g-dev apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf cmake libjpeg-turbo8-dev apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
install:
- git clone --depth=10 --branch=master git://source.ffmpeg.org/ffmpeg.git
- cd ffmpeg
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ endif(NOT ZM_WEB_GROUP)
message(STATUS "Using web user: ${ZM_WEB_USER}")
message(STATUS "Using web group: ${ZM_WEB_GROUP}")

# Check for polkit
find_package(Polkit)
if(NOT POLKIT_FOUND)
message(FATAL_ERROR "Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
endif(NOT POLKIT_FOUND)

# Some variables that zm expects
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf")
Expand All @@ -502,16 +508,15 @@ add_subdirectory(src)
add_subdirectory(scripts)
add_subdirectory(db)
add_subdirectory(web)
add_subdirectory(misc)

# Process misc subdirectories
# Process distro subdirectories
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")

# Print optional libraries detection status
Expand Down
55 changes: 55 additions & 0 deletions cmake/Modules/FindGLIB2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# - Try to find the GLIB2 libraries
# Once done this will define
#
# GLIB2_FOUND - system has glib2
# GLIB2_INCLUDE_DIR - the glib2 include directory
# GLIB2_LIBRARIES - glib2 library

# Copyright (c) 2008 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
# Already in cache, be silent
set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)

if (NOT WIN32)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LibGLIB2 glib-2.0)
endif (PKG_CONFIG_FOUND)
endif(NOT WIN32)

if (PC_LibGLIB2_INCLUDEDIR)
set(GLIB2_MAIN_INCLUDE_DIR ${PC_LibGLIB2_INCLUDEDIR})
else (PC_LibGLIB2_INCLUDEDIR)
find_path(GLIB2_MAIN_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0)
endif (PC_LibGLIB2_INCLUDEDIR)

# search the glibconfig.h include dir under the same root where the library is found
find_library(GLIB2_LIBRARIES
NAMES glib-2.0
HINTS ${PC_LibGLIB2_LIBDIR}
)

get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)

find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
PATH_SUFFIXES glib-2.0/include
HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH})

set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")

# not sure if this include dir is optional or required
# for now it is optional
if(GLIB2_INTERNAL_INCLUDE_DIR)
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
endif(GLIB2_INTERNAL_INCLUDE_DIR)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)

mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)
63 changes: 63 additions & 0 deletions cmake/Modules/FindPolkit.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# - Try to find Polkit
# Once done this will define
#
# POLKIT_FOUND - system has Polkit
# POLKIT_INCLUDE_DIRS - Polkit's include directories
# POLKIT_AGENT_INCLUDE_DIRS - Polkit-agent's include directories
# POLKIT_LIBRARIES - Link this to use polkit's gobject library
# POLKIT_AGENT_LIBRARY - Link this to use the agent wrapper in polkit
# POLKIT_DEFINITIONS - Compiler switches required for using Polkit
# Copyright (c) 2009, Dario Freddi, <drf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#NOTE: Polkit agent library is disabled!
if (POLKIT_INCLUDE_DIR AND POLKIT_LIB)
set(POLKIT_FIND_QUIETLY TRUE)
endif (POLKIT_INCLUDE_DIR AND POLKIT_LIB)
if (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_POLKIT polkit-gobject-1)
#pkg_check_modules(PC_POLKIT_AGENT polkit-agent-1)
set(POLKIT_DEFINITIONS ${PC_POLKIT_CFLAGS_OTHER})
endif (NOT WIN32)
# We must include glib paths too... which sucks balls
find_package(GLIB2)
find_path( GLIB_CONFIG_INCLUDE_DIR
NAMES glibconfig.h
PATH_SUFFIXES glib-2.0/include
HINTS ${PC_POLKIT_INCLUDE_DIRS}
)
find_path( POLKIT_INCLUDE_DIR
NAMES polkit/polkit.h
PATH_SUFFIXES polkit-1
HINTS ${PC_POLKIT_INCLUDE_DIRS}
)
#find_path( POLKIT_AGENT_INCLUDE_DIR
# NAMES polkitagent/polkitagent.h
# PATH_SUFFIXES polkit-1
# HINTS ${PC_POLKIT_AGENT_INCLUDE_DIRS}
#)
#set(POLKIT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_INCLUDE_DIR})
#set(POLKIT_AGENT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_AGENT_INCLUDE_DIR})
find_library( POLKIT_LIBRARIES
NAMES polkit-gobject-1
HINTS ${PC_POLKIT_LIBDIR}
)
#find_library( POLKIT_AGENT_LIBRARY
# NAMES polkit-agent-1
# HINTS ${PC_POLKIT_AGENT_LIBDIR}
#)
#set(POLKIT_LIBRARIES ${_POLKIT_LIBRARIES} ${GLIB2_LIBRARIES})
#set(POLKIT_AGENT_LIBRARY ${_POLKIT_AGENT_LIBRARY} ${GLIB2_LIBRARIES})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set POLKIT_FOUND to TRUE if
# all listed variables are TRUE
#find_package_handle_standard_args(Polkit DEFAULT_MSG POLKIT_LIBRARIES POLKIT_AGENT_LIBRARY
# POLKIT_INCLUDE_DIR POLKIT_AGENT_INCLUDE_DIR GLIB2_FOUND)
find_package_handle_standard_args(Polkit DEFAULT_MSG POLKIT_LIBRARIES
POLKIT_INCLUDE_DIR GLIB2_FOUND)
mark_as_advanced(POLKIT_INCLUDE_DIRS POLKIT_AGENT_INCLUDE_DIRS POLKIT_LIBRARIES POLKIT_AGENT_LIBRARY GLIB_INCLUDE_DIR)
set(POLKIT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions)
11 changes: 10 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ AC_SUBST(MARIADB_LIBS)
AC_SUBST(MARIADB_CFLAGS)
LDFLAGS="$LDFLAGS ${MARIADB_LIBS}"

POLKIT_PREFIX=/usr
AC_ARG_WITH(polkit,
[ --with-polkit=<path> prefix of polkit root directory, default /usr],
[POLKIT_PREFIX=$with_polkit],
AC_MSG_WARN([You can call configure with the --with-polkit option.
This tells configure where to place the polkit policy files.])
)
AC_SUBST(POLKIT_PREFIX)
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)

FFMPEG_PREFIX=/usr
AC_ARG_WITH(ffmpeg,
Expand Down Expand Up @@ -433,7 +442,7 @@ AC_SUBST(PERL_MM_PARMS)
AC_SUBST(EXTRA_PERL_LIB)


AC_CONFIG_FILES([Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql misc/Makefile misc/apache.conf misc/logrotate.conf misc/syslog.conf scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmcamtool.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/lang/Makefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/skins/flat/Makefile web/skins/flat/ajax/Makefile web/skins/flat/css/Makefile web/skins/flat/graphics/Makefile web/skins/flat/includes/Makefile web/skins/flat/js/Makefile web/skins/flat/lang/Makefile web/skins/flat/views/Makefile web/skins/flat/views/css/Makefile web/skins/flat/views/js/Makefile])
AC_CONFIG_FILES([Makefile zm.conf zmconfgen.pl db/Makefile db/zm_create.sql misc/Makefile misc/apache.conf misc/logrotate.conf misc/syslog.conf misc/com.zoneminder.systemctl.policy misc/com.zoneminder.systemctl.rules scripts/Makefile scripts/zm scripts/zmaudit.pl scripts/zmcontrol.pl scripts/zmdc.pl scripts/zmfilter.pl scripts/zmpkg.pl scripts/zmtrack.pl scripts/zmcamtool.pl scripts/zmtrigger.pl scripts/zmupdate.pl scripts/zmvideo.pl scripts/zmwatch.pl scripts/zmx10.pl scripts/zmdbbackup scripts/zmdbrestore scripts/zmeventdump scripts/zmlogrotate.conf scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm src/Makefile src/zm_config.h web/Makefile web/ajax/Makefile web/css/Makefile web/graphics/Makefile web/includes/Makefile web/includes/config.php web/js/Makefile web/lang/Makefile web/skins/Makefile web/skins/classic/Makefile web/skins/classic/ajax/Makefile web/skins/classic/css/Makefile web/skins/classic/graphics/Makefile web/skins/classic/includes/Makefile web/skins/classic/js/Makefile web/skins/classic/lang/Makefile web/skins/classic/views/Makefile web/skins/classic/views/css/Makefile web/skins/classic/views/js/Makefile web/skins/mobile/Makefile web/skins/mobile/ajax/Makefile web/skins/mobile/css/Makefile web/skins/mobile/graphics/Makefile web/skins/mobile/includes/Makefile web/skins/mobile/lang/Makefile web/skins/mobile/views/Makefile web/skins/mobile/views/css/Makefile web/tools/Makefile web/tools/mootools/Makefile web/views/Makefile web/skins/xml/Makefile web/skins/xml/views/Makefile web/skins/xml/includes/Makefile web/skins/flat/Makefile web/skins/flat/ajax/Makefile web/skins/flat/css/Makefile web/skins/flat/graphics/Makefile web/skins/flat/includes/Makefile web/skins/flat/js/Makefile web/skins/flat/lang/Makefile web/skins/flat/views/Makefile web/skins/flat/views/css/Makefile web/skins/flat/views/js/Makefile])

# Create the definitions for compilation and defaults for the database
AC_CONFIG_COMMANDS([src/zm_config_defines.h],[perl ./zmconfgen.pl])
Expand Down
8 changes: 6 additions & 2 deletions distros/fedora/zoneminder.cmake.f19.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ BuildRequires: gcc gcc-c++ vlc-devel libcurl-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
BuildRequires: httpd polkit-devel
%{!?_without_ffmpeg:BuildRequires: ffmpeg}

Requires: httpd php php-mysql cambozola
Requires: httpd php php-mysql cambozola polkit
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)
Expand Down Expand Up @@ -149,6 +149,7 @@ fi
%{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl
%{_bindir}/zmcamtool.pl
%{_bindir}/zmsystemctl.pl
%{!?_without_x10:%{_bindir}/zmx10.pl}

%{perl_vendorlib}/ZoneMinder*
Expand All @@ -161,6 +162,9 @@ fi
%{_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
Expand Down
8 changes: 6 additions & 2 deletions distros/fedora/zoneminder.f19.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ 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
BuildRequires: autoconf autoconf-archive
BuildRequires: autoconf autoconf-archive polkit-devel
%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel}
%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)}

Requires: httpd php php-mysql cambozola
Requires: httpd php php-mysql cambozola polkit
Requires: libjpeg-turbo libcurl vlc-core ffmpeg
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
Expand Down Expand Up @@ -240,6 +240,7 @@ fi
%{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl
%{_bindir}/zmcamtool.pl
%{_bindir}/zmsystemctl.pl
%{!?_without_x10:%{_bindir}/zmx10.pl}

%{perl_vendorlib}/ZoneMinder*
Expand All @@ -250,6 +251,9 @@ fi
%{_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
Expand Down
8 changes: 6 additions & 2 deletions distros/opensuse/zoneminder.cmake.OS13.spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Source: ZoneMinder-%{version}.tar.gz
# patch no longer necessary as OpenSuse now in standard build
# Patch1: zoneminder-1.26.5-opensuse.patch

BuildRequires: cmake
BuildRequires: cmake polkit-devel
BuildRequires: perl-DBI perl-DBD-mysql perl-Date-Manip perl-Sys-Mmap
BuildRequires: libjpeg62 libjpeg62-devel libmysqld-devel libSDL-devel libgcrypt-devel libgnutls-devel
BuildRequires: libffmpeg-devel x264
BuildRequires: pcre-devel w32codec-all

Requires: apache2 apache2-mod_php5 mysql
Requires: apache2 apache2-mod_php5 mysql polkit
Requires: ffmpeg libavformat55
Requires: php php-mysql
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Expand Down Expand Up @@ -158,6 +158,10 @@ fi
%{webcgi}/nph-zms
%{webcgi}/zms
%{webroot}/zoneminder

%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy
%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules

%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/images
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/temp
Expand Down
8 changes: 6 additions & 2 deletions distros/redhat/zoneminder.cmake.el6.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ 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(X10::ActiveHome) perl(Astro::SunTime)
BuildRequires: libcurl-devel vlc-devel ffmpeg-devel
BuildRequires: libcurl-devel vlc-devel ffmpeg-devel polkit-devel
# cmake needs the following installed at build time due to the way it auto-detects certain parameters
BuildRequires: httpd ffmpeg

Requires: httpd php php-mysql mysql-server libjpeg-turbo
Requires: httpd php php-mysql mysql-server libjpeg-turbo polkit
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)
Expand Down Expand Up @@ -138,6 +138,7 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl
%{_bindir}/zmcamtool.pl
%{_bindir}/zmsystemctl.pl
%{_bindir}/zmx10.pl

%{perl_vendorlib}/ZoneMinder*
Expand All @@ -149,6 +150,9 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_datadir}/%{name}/db
%{_datadir}/%{name}/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}) %{_localstatedir}/lib/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
Expand Down
8 changes: 6 additions & 2 deletions distros/redhat/zoneminder.el6.spec
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ 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(X10::ActiveHome) perl(Astro::SunTime)
BuildRequires: libcurl-devel vlc-devel ffmpeg-devel >= 0.4.9
BuildRequires: libcurl-devel vlc-devel polkit-devel ffmpeg-devel >= 0.4.9

Requires: httpd php php-mysql mysql-server libjpeg-turbo
Requires: httpd php php-mysql mysql-server libjpeg-turbo polkit
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)
Expand Down Expand Up @@ -245,6 +245,7 @@ fi
%{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl
%{_bindir}/zmcamtool.pl
%{_bindir}/zmsystemctl.pl
%{_bindir}/zmx10.pl

%{perl_vendorlib}/ZoneMinder*
Expand All @@ -255,6 +256,9 @@ fi
%{_datadir}/%{name}/db
%{_datadir}/%{name}/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}) %{_localstatedir}/lib/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
Expand Down
7 changes: 7 additions & 0 deletions misc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
configure_file(apache.conf.in "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" @ONLY)
configure_file(logrotate.conf.in "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" @ONLY)
configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY)
configure_file(com.zoneminder.systemctl.policy.in "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.policy" @ONLY)
configure_file(com.zoneminder.systemctl.rules.in "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.rules" @ONLY)
configure_file(zoneminder.service.in "${CMAKE_CURRENT_BINARY_DIR}/zoneminder.service" @ONLY)

# Do not install the misc files by default
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc")

# Install Policykit rules and actions into the proper folders
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.policy" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/actions")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.rules" DESTINATION "${PC_POLKIT_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/polkit-1/rules.d")

12 changes: 11 additions & 1 deletion misc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@ AUTOMAKE_OPTIONS = gnu
EXTRA_DIST = \
apache.conf.in \
logrotate.conf.in \
syslog.conf.in
syslog.conf.in \
zoneminder.service.in \
com.zoneminder.systemctl.policy.in \
com.zoneminder.systemctl.rules.in

polkit_actiondir = @POLKIT_PREFIX@/share/polkit-1/actions
dist_polkit_action_DATA = com.zoneminder.systemctl.policy

polkit_rulesdir = @POLKIT_PREFIX@/share/polkit-1/rules.d
dist_polkit_rules_DATA = com.zoneminder.systemctl.rules

Loading

10 comments on commit 1e8e710

@manupap1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to not install the zoneminder.service file at this time with autotools ? (not included in AC_CONFIG_FILES)
On my server (debian jessie), zm fails to start because of this missing file.
The service hangs forever on starting and there is no fallback to sysvinit.
I added manually the file but I had to comment the Requires line as both mysqld.service and httpd.service files are not yet available on debian.

@knight-of-ni
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, zoneminder has neither installed the sys v init file nor will it install the systemd service file.
This is by design and is only the case when building from source, rather than from package. The distro-specific packaging scripts take care of installing the correct startup script.

@manupap1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, got it. I mixed up the files with those from a previous installation.
The comment is still usefull because the file is not generated by autotools (it is with cmake).

@patmans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in the past zoneminder could run without installing the sys v init files - you could start it via "zmpkg.pl start"

With the current zoneminder systemd intergration, if you don't install the zoneminder.service file, zoneminder can't start. In addition, there's nothing about this requirement in the INSTALL file.

It really should be installed even for source builds, or at least the INSTALL documentation should be updated.

Similar for the /etc/tmpfiles.d/zoneminder.conf - also, that file should be installed to /usr/lib/tmpfiles.d, at least on Fedora 21, per man tmpfiles.d and http://fedoraproject.org/wiki/Packaging:Tmpfiles.d

PS: I'm running zoneminder 1.28 on Fedora 21, via the tar file download. Keep up the good work :-)

@knight-of-ni
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmans Exactly. In the past and in a sys v init environment. Systemd requires a service file. This is just one example where systemd is not flexible like the old sys v init. Systemd only looks similar on the surface. Under the hood it is a completely different animal and there is no way to accomplish what you are asking w/o breaking other things.

Zoneminder handles the systemd service file exactly the same way it has always handled the old sys v init script. This functionality has not changed. When building from source, it is up to you to choose the correct startup script, verify it is correct for your system, copy it from the source tree, and into the correct place. It is not possible to write a script that gets this right for every single distro out there.

Now if you install from a package then you can expect the package maintainer to have done this work for you. The correct script should get auto-installed. If it isn't then it should be reported as a bug to the package maintainer.

@patmans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could conditionally copy the service file depending on whether or not systemd is in installed.

But in any case the INSTALL file should be updated.

@knight-of-ni
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we absolutely cannot! That would require us to make assumptions that won't be true in every case.
Take Ubuntu 14.10 for example. It has both sys v init and systemd installed on it at the same time. As soon as we make the assumption that we should go with sys v init then that would break any install that chooses to go with systemd.

Go look at other open source softwares and you will see that this task has always been handled by the package maintainer.

I will update the INSTALL file to make it more clear what you need to do (step 10 I presume)

@patmans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already have distro specific cmake files - so only install it for Fedora.

@knight-of-ni
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is already done in the Fedora specfile. If you don't want to have to put on your developer hat on then you should not be building from source. Use zmrepo to install the rpm package instead.

@patmans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There aren't any repos for F21, and the RPM I'd been using was for F19, so I chose to use the source.

I thought of just trying to build via the specfile, but decided to build from source first.

I wouldn't be posting here if I hadn't put my developer hat on ...

Please sign in to comment.