Browse Source

use configure_file to set binary path

Max von Buelow 6 years ago
parent
commit
6e7d9bc0b9
3 changed files with 13 additions and 12 deletions
  1. 2 1
      CMakeLists.txt
  2. 0 11
      systemd/milterfrom.service
  3. 11 0
      systemd/milterfrom.service.in

+ 2 - 1
CMakeLists.txt

@@ -16,5 +16,6 @@ target_link_libraries(milterfrom ${Milter_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
 
 
 install(TARGETS milterfrom DESTINATION bin)
 install(TARGETS milterfrom DESTINATION bin)
 if(NOT WIN32 AND WITH_SYSTEMD)
 if(NOT WIN32 AND WITH_SYSTEMD)
-	install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/milterfrom.service DESTINATION ${SYSTEMD_UNITDIR})
+	configure_file(systemd/milterfrom.service.in ${CMAKE_CURRENT_BINARY_DIR}/systemd/milterfrom.service)
+	install(FILES ${CMAKE_CURRENT_BINARY_DIR}/systemd/milterfrom.service DESTINATION ${SYSTEMD_UNITDIR})
 endif()
 endif()

+ 0 - 11
systemd/milterfrom.service

@@ -1,11 +0,0 @@
-[Unit]
-Description=A milter that enforces equal envelope and header sender
-
-[Service]
-Type=forking
-PIDFile=/var/run/milterfrom.pid
-ExecStart=/usr/local/bin/milterfrom -d -p /var/run/milterfrom.pid -u milterfrom -g milterfrom -m 002 -s /var/spool/postfix/milterfrom/milterfrom
-ExecReload=/bin/kill -HUP $MAINPID
-
-[Install]
-WantedBy=multi-user.target

+ 11 - 0
systemd/milterfrom.service.in

@@ -0,0 +1,11 @@
+[Unit]
+Description=A milter that enforces equal envelope and header sender
+
+[Service]
+Type=forking
+PIDFile=/var/run/milterfrom.pid
+ExecStart=@CMAKE_INSTALL_PREFIX@/bin/milterfrom -d -p /var/run/milterfrom.pid -u milterfrom -g milterfrom -m 002 -s /var/spool/postfix/milterfrom/milterfrom
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target