소스 검색

Initial systemd support

tags/1.2
bjoe2k4 10 년 전
부모
커밋
b4bcb77ca7
3개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 5
    1
      CMakeLists.txt
  2. 2
    0
      postinstall.cmake.in
  3. 13
    0
      postsrsd.service.in

+ 5
- 1
CMakeLists.txt 파일 보기

@@ -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,7 @@ 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)
65 69
 configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
66 70
 
67 71
 if(HELP2MAN)

+ 2
- 0
postinstall.cmake.in 파일 보기

@@ -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}")

+ 13
- 0
postsrsd.service.in 파일 보기

@@ -0,0 +1,13 @@
1
+Description=PostSRSd Daemon
2
+After=network.target
3
+
4
+[Service]
5
+Type=simple
6
+Environment=SRS_DOMAIN=localhost.localdomain SRS_FORWARD_PORT=10001 SRS_REVERSE_PORT=10002 SRS_SECRET=@SYSCONF_DIR@/@PROJECT_NAME@.secret
7
+Environment=SRS_EXCLUDE_DOMAINS= RUN_AS=nobody CHROOT=@CHROOT_DIR@
8
+EnvironmentFile=-@CONFIG_DIR@/@PROJECT_NAME@
9
+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}
10
+Restart=always
11
+
12
+[Install]
13
+WantedBy=multi-user.target

Loading…
취소
저장