From 25475b60ab363299ddbe5e81ded8968b76838b44 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 13 Jan 2016 19:44:58 +0100 Subject: Generate systemd file from template and make installs it and the conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unit file Type=, as well as the executable path should now be correct with a simple “make install”, whatever the install prefix and the DESTDIR values are. ref #3152 --- CMakeLists.txt | 18 ++++++++++++------ packaging/biboumi.spec | 12 ++++-------- unit/biboumi.service | 15 --------------- unit/biboumi.service.cmake | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 unit/biboumi.service create mode 100644 unit/biboumi.service.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c27477..3ff7be6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,11 +200,10 @@ endif() # ## Install target # -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin) -if(WITH_DOC) - install(FILES ${MAN_PAGE} DESTINATION share/man/man1 OPTIONAL) -endif() +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) +install(FILES ${MAN_PAGE} DESTINATION share/man/man1 OPTIONAL COMPONENT documentation) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/biboumi.service DESTINATION /etc/systemd/system COMPONENT init) +install(FILES conf/biboumi.cfg DESTINATION /etc/biboumi COMPONENT configuration) # ## Dist target @@ -228,4 +227,11 @@ endif() add_custom_target(PrintBuildParameters ALL ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Compiling ${PROJECT_NAME} with ${STR_WITH_BOTAN}, ${STR_WITH_CARES}") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/biboumi.h.cmake ${CMAKE_BINARY_DIR}/src/biboumi.h) +configure_file(biboumi.h.cmake src/biboumi.h) + +if(SYSTEMD_FOUND) + set(SYSTEMD_SERVICE_TYPE "notify") +else() + set(SYSTEMD_SERVICE_TYPE "simple") +endif() +configure_file(unit/biboumi.service.cmake biboumi.service) diff --git a/packaging/biboumi.spec b/packaging/biboumi.spec index fb9a30f..e375504 100644 --- a/packaging/biboumi.spec +++ b/packaging/biboumi.spec @@ -49,14 +49,6 @@ LC_ALL=en_GB.utf-8 make doc %install make install DESTDIR=%{buildroot} -# Default config file -install -D -p -m 644 conf/biboumi.cfg \ - %{buildroot}%{biboumi_confdir}/biboumi.cfg - -# Systemd unit file -install -D -p -m 644 unit/%{name}.service \ - %{buildroot}%{_unitdir}/%{name}.service - %check make test_suite/fast VERBOSE=1 @@ -73,6 +65,10 @@ make test_suite/fast VERBOSE=1 %changelog +* Wed Jan 13 2016 Le Coz Florent - 2.0-2 +- Do not install the systemd unit and configuration files, because + “make install” does it itself now + * Fri May 29 2015 Le Coz Florent - 2.0-1 - Update to 2.0 sources diff --git a/unit/biboumi.service b/unit/biboumi.service deleted file mode 100644 index 59001a6..0000000 --- a/unit/biboumi.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Biboumi, XMPP to IRC gateway -After=network.target - -[Service] -Type=notify -ExecStart=/usr/bin/biboumi /etc/biboumi/biboumi.cfg -ExecReload=/bin/kill -s USR1 $MAINPID -WatchdogSec=10 -Restart=always -User=nobody -Group=nobody - -[Install] -WantedBy=multi-user.target diff --git a/unit/biboumi.service.cmake b/unit/biboumi.service.cmake new file mode 100644 index 0000000..0a9b76b --- /dev/null +++ b/unit/biboumi.service.cmake @@ -0,0 +1,15 @@ +[Unit] +Description=Biboumi, XMPP to IRC gateway +After=network.target + +[Service] +Type=${SYSTEMD_SERVICE_TYPE} +ExecStart=${CMAKE_INSTALL_PREFIX}/bin/biboumi /etc/biboumi/biboumi.cfg +ExecReload=/bin/kill -s USR1 $MAINPID +WatchdogSec=10 +Restart=always +User=nobody +Group=nobody + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3