1
0
Fork 0

calculate systemd unit directory in cmake instead of leaning on specfile finding it in some rpm magic

This commit is contained in:
Wilfried Goesgens 2016-09-28 11:10:46 +02:00
parent f96bfbfade
commit 69e453ad54
2 changed files with 26 additions and 22 deletions

View File

@ -131,8 +131,8 @@ mkdir -p %{buildroot}%{_piddir}
%{_datadir}/arangodb3
%{_sysconfdir}/init.d/arangodb3
%if 0%{?suse_version} >= 1210
%{_unitdir}/@CPACK_PACKAGE_NAME@.service
%if @IS_SYSTEMD_INSTALL@
@SYSTEMD_UNIT_DIR@/@CPACK_PACKAGE_NAME@.service
%endif
@ -175,7 +175,7 @@ mkdir -p %{buildroot}%{_piddir}
%{fillup_and_insserv -f -y arangodb3}
%restart_on_update arangodb3
%if 0%{?suse_version} >= 1210
%if @IS_SYSTEMD_INSTALL@
%service_add_post @CPACK_PACKAGE_NAME@.service
%endif
@ -206,7 +206,7 @@ Start ArangoDB shell client:
> %{_bindir}/arangosh
"
%if 0%{?suse_version} >= 1210
%if @IS_SYSTEMD_INSTALL@
echo "Start ArangoDB service:
> systemctl start arangodb3.service
@ -241,7 +241,7 @@ exit 0
%restart_on_update arangodb3
%insserv_cleanup
%if 0%{?suse_version} >= 1210
%if @IS_SYSTEMD_INSTALL@
%service_del_postun arangodb3.service
%endif
@ -265,7 +265,7 @@ if ! getent passwd arangodb >/dev/null 2>&1; then
/usr/sbin/usermod -c "Arango Server" arangodb
fi
%if 0%{?suse_version} >= 1210
%if @IS_SYSTEMD_INSTALL@
%service_add_pre arangodb3.service
%endif
@ -274,12 +274,10 @@ fi
## -----------------------------------------------------------------------------
%preun
%if 0%{?suse_version}
%if @IS_SYSTEMD_INSTALL@
%stop_on_removal arangodb3
%if 0%{?suse_version} >= 1210
%service_del_preun arangodb3.service
%endif
%else
%{_sysconfdir}/init.d/arangodb stop > /dev/null 2>&1 || true

View File

@ -85,21 +85,27 @@ install(
################################################################################
### @brief detect if we're on a systemd enabled system; if install unit file.
################################################################################
if (IS_DIRECTORY /usr/lib/systemd/system)
configure_file (
${ARANGODB_SOURCE_DIR}/Installation/systemd/arangodb3.service.in
${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service
NEWLINE_STYLE UNIX)
if (${USE_ENTERPRISE})
install(FILES ${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service
DESTINATION /usr/lib/systemd/system/arangodb3e.service)
else()
install(FILES ${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service
DESTINATION /usr/lib/systemd/system/arangodb3.service)
set(IS_SYSTEMD_INSTALL false)
set(SYSTEMD_UNIT_DIR "")
if (UNIX)
find_package(PkgConfig QUIET)
pkg_check_modules(SYSTEMD systemd)
if (SYSTEMD_FOUND)
pkg_get_variable(SYSTEMD_UNIT_DIR systemd systemdsystemunitdir)
set(IS_SYSTEMD_INSTALL true)
configure_file (
${ARANGODB_SOURCE_DIR}/Installation/systemd/arangodb3.service.in
${PROJECT_BINARY_DIR}${SYSTEMD_UNIT_DIR}/arangodb3.service
NEWLINE_STYLE UNIX)
if (${USE_ENTERPRISE})
install(FILES ${PROJECT_BINARY_DIR}${SYSTEMD_UNIT_DIR}/arangodb3.service
DESTINATION ${SYSTEMD_UNIT_DIR}/arangodb3e.service)
else()
install(FILES ${PROJECT_BINARY_DIR}${SYSTEMD_UNIT_DIR}/arangodb3.service
DESTINATION ${SYSTEMD_UNIT_DIR}/arangodb3.service)
endif()
endif()
endif()
################################################################################
### @brief propagate the locations into our programms:
################################################################################