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 %{_datadir}/arangodb3
%{_sysconfdir}/init.d/arangodb3 %{_sysconfdir}/init.d/arangodb3
%if 0%{?suse_version} >= 1210 %if @IS_SYSTEMD_INSTALL@
%{_unitdir}/@CPACK_PACKAGE_NAME@.service @SYSTEMD_UNIT_DIR@/@CPACK_PACKAGE_NAME@.service
%endif %endif
@ -175,7 +175,7 @@ mkdir -p %{buildroot}%{_piddir}
%{fillup_and_insserv -f -y arangodb3} %{fillup_and_insserv -f -y arangodb3}
%restart_on_update arangodb3 %restart_on_update arangodb3
%if 0%{?suse_version} >= 1210 %if @IS_SYSTEMD_INSTALL@
%service_add_post @CPACK_PACKAGE_NAME@.service %service_add_post @CPACK_PACKAGE_NAME@.service
%endif %endif
@ -206,7 +206,7 @@ Start ArangoDB shell client:
> %{_bindir}/arangosh > %{_bindir}/arangosh
" "
%if 0%{?suse_version} >= 1210 %if @IS_SYSTEMD_INSTALL@
echo "Start ArangoDB service: echo "Start ArangoDB service:
> systemctl start arangodb3.service > systemctl start arangodb3.service
@ -241,7 +241,7 @@ exit 0
%restart_on_update arangodb3 %restart_on_update arangodb3
%insserv_cleanup %insserv_cleanup
%if 0%{?suse_version} >= 1210 %if @IS_SYSTEMD_INSTALL@
%service_del_postun arangodb3.service %service_del_postun arangodb3.service
%endif %endif
@ -265,7 +265,7 @@ if ! getent passwd arangodb >/dev/null 2>&1; then
/usr/sbin/usermod -c "Arango Server" arangodb /usr/sbin/usermod -c "Arango Server" arangodb
fi fi
%if 0%{?suse_version} >= 1210 %if @IS_SYSTEMD_INSTALL@
%service_add_pre arangodb3.service %service_add_pre arangodb3.service
%endif %endif
@ -274,12 +274,10 @@ fi
## ----------------------------------------------------------------------------- ## -----------------------------------------------------------------------------
%preun %preun
%if 0%{?suse_version} %if @IS_SYSTEMD_INSTALL@
%stop_on_removal arangodb3 %stop_on_removal arangodb3
%if 0%{?suse_version} >= 1210
%service_del_preun arangodb3.service %service_del_preun arangodb3.service
%endif
%else %else
%{_sysconfdir}/init.d/arangodb stop > /dev/null 2>&1 || true %{_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. ### @brief detect if we're on a systemd enabled system; if install unit file.
################################################################################ ################################################################################
if (IS_DIRECTORY /usr/lib/systemd/system) set(IS_SYSTEMD_INSTALL false)
configure_file ( set(SYSTEMD_UNIT_DIR "")
${ARANGODB_SOURCE_DIR}/Installation/systemd/arangodb3.service.in if (UNIX)
${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service find_package(PkgConfig QUIET)
NEWLINE_STYLE UNIX) pkg_check_modules(SYSTEMD systemd)
if (${USE_ENTERPRISE}) if (SYSTEMD_FOUND)
install(FILES ${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service pkg_get_variable(SYSTEMD_UNIT_DIR systemd systemdsystemunitdir)
DESTINATION /usr/lib/systemd/system/arangodb3e.service) set(IS_SYSTEMD_INSTALL true)
else() configure_file (
install(FILES ${PROJECT_BINARY_DIR}/usr/lib/systemd/system/arangodb3.service ${ARANGODB_SOURCE_DIR}/Installation/systemd/arangodb3.service.in
DESTINATION /usr/lib/systemd/system/arangodb3.service) ${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()
endif() endif()
################################################################################ ################################################################################
### @brief propagate the locations into our programms: ### @brief propagate the locations into our programms:
################################################################################ ################################################################################