Kaynağa Gözat

Merge initial systemd support from bjoe2k4

tags/1.2
Timo Röhling 10 yıl önce
ebeveyn
işleme
fefe8efceb
4 değiştirilmiş dosya ile 25 ekleme ve 3 silme
  1. 7
    1
      CMakeLists.txt
  2. 3
    1
      postinstall.cmake.in
  3. 1
    1
      postsrsd.default.in
  4. 14
    0
      postsrsd.service.in

+ 7
- 1
CMakeLists.txt Dosyayı Görüntüle

@@ -34,7 +34,10 @@ if(HAVE_TIME_H)
34 34
 endif()
35 35
 
36 36
 if(NOT DEFINED INIT_FLAVOR)
37
-    if(IS_DIRECTORY "${SYSCONF_DIR}/init" AND EXISTS "/lib/init/upstart-job")
37
+	if(IS_DIRECTORY "${SYSCONF_DIR}/systemd" AND EXISTS "/usr/lib/systemd/systemd")
38
+        message(STATUS "Detected init flavor: systemd")
39
+        set(INIT_FLAVOR "systemd" CACHE STRING "Init daemon of this system")
40
+    elseif(IS_DIRECTORY "${SYSCONF_DIR}/init" AND EXISTS "/lib/init/upstart-job")
38 41
         message(STATUS "Detected init flavor: upstart")
39 42
         set(INIT_FLAVOR "upstart" CACHE STRING "Init daemon of this system")
40 43
     elseif(IS_DIRECTORY "${SYSCONF_DIR}/init.d" AND EXISTS "${SYSCONF_DIR}/init.d/functions")
@@ -62,6 +65,9 @@ configure_file(${PROJECT_NAME}.lsb_init.in ${PROJECT_NAME}.lsb_init @ONLY)
62 65
 configure_file(${PROJECT_NAME}.rh_init.in ${PROJECT_NAME}.rh_init @ONLY)
63 66
 configure_file(${PROJECT_NAME}.upstart.in ${PROJECT_NAME}.upstart @ONLY)
64 67
 configure_file(${PROJECT_NAME}.apparmor.in ${PROJECT_NAME}.apparmor @ONLY)
68
+configure_file(${PROJECT_NAME}.service.in ${PROJECT_NAME}.service @ONLY)
69
+configure_file(${PROJECT_NAME}.default.in ${PROJECT_NAME}.default @ONLY)
70
+
65 71
 configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
66 72
 
67 73
 if(HELP2MAN)

+ 3
- 1
postinstall.cmake.in Dosyayı Görüntüle

@@ -15,7 +15,7 @@ if(CHROOT_DIR AND NOT EXISTS "$ENV{DESTDIR}${CHROOT_DIR}")
15 15
 endif()
16 16
 
17 17
 if(INIT_FLAVOR AND NOT EXISTS "$ENV{DESTDIR}${CONFIG_DIR}/@PROJECT_NAME@")
18
-	file(INSTALL FILES "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "${CONFIG_DIR}" RENAME "@PROJECT_NAME@")
18
+	file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.default" DESTINATION "${CONFIG_DIR}" RENAME "@PROJECT_NAME@")
19 19
 endif()
20 20
 
21 21
 if(INIT_FLAVOR STREQUAL "sysv-lsb")
@@ -34,6 +34,8 @@ elseif(INIT_FLAVOR STREQUAL "sysv-redhat")
34 34
 	endif()
35 35
 elseif(INIT_FLAVOR STREQUAL "upstart")
36 36
 	file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "${SYSCONF_DIR}/init" RENAME "@PROJECT_NAME@.conf")
37
+elseif(INIT_FLAVOR STREQUAL "systemd")
38
+	file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.service" DESTINATION "${SYSCONF_DIR}/systemd/system" RENAME "@PROJECT_NAME@.service")
37 39
 endif()
38 40
 
39 41
 if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")

postsrsd.default → postsrsd.default.in Dosyayı Görüntüle

@@ -17,7 +17,7 @@
17 17
 # When postsrsd is installed for the first time, a random secret is generated
18 18
 # and stored in /etc/postsrsd.secret. For most installations, that's just fine.
19 19
 #
20
-#SRS_SECRET=/etc/postsrsd.secret
20
+SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
21 21
 
22 22
 # Local ports for TCP list.
23 23
 # These ports are used to bind the TCP list for postfix. If you change

+ 14
- 0
postsrsd.service.in Dosyayı Görüntüle

@@ -0,0 +1,14 @@
1
+[Unit]
2
+Description=PostSRSd Daemon
3
+After=network.target
4
+
5
+[Service]
6
+Type=simple
7
+Environment=SRS_DOMAIN=localhost.localdomain SRS_FORWARD_PORT=10001 SRS_REVERSE_PORT=10002 SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
8
+Environment=SRS_EXCLUDE_DOMAINS= RUN_AS=nobody CHROOT=@CHROOT_DIR@
9
+EnvironmentFile=-@CONFIG_DIR@/@PROJECT_NAME@
10
+ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@ -4 -f${SRS_FORWARD_PORT} -r${SRS_REVERSE_PORT} -d${SRS_DOMAIN} -s${SRS_SECRET} -u${RUN_AS} -c${CHROOT} -X${SRS_EXCLUDE_DOMAINS}
11
+Restart=always
12
+
13
+[Install]
14
+WantedBy=multi-user.target

Loading…
İptal
Kaydet