|
@@ -1,31 +1,24 @@
|
1
|
|
-message(STATUS "Updating RC: $ENV{DESTDIR}/etc/init.d/@PROJECT_NAME@")
|
2
|
|
-file(MAKE_DIRECTORY
|
3
|
|
- "$ENV{DESTDIR}/etc/rc0.d"
|
4
|
|
- "$ENV{DESTDIR}/etc/rc1.d"
|
5
|
|
- "$ENV{DESTDIR}/etc/rc2.d"
|
6
|
|
- "$ENV{DESTDIR}/etc/rc3.d"
|
7
|
|
- "$ENV{DESTDIR}/etc/rc4.d"
|
8
|
|
- "$ENV{DESTDIR}/etc/rc5.d"
|
9
|
|
- "$ENV{DESTDIR}/etc/rc6.d"
|
10
|
|
-)
|
11
|
|
-execute_process(
|
12
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc0.d/K20@PROJECT_NAME@
|
13
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc1.d/K20@PROJECT_NAME@
|
14
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc2.d/S20@PROJECT_NAME@
|
15
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc3.d/S20@PROJECT_NAME@
|
16
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc4.d/S20@PROJECT_NAME@
|
17
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc5.d/S20@PROJECT_NAME@
|
18
|
|
- COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc6.d/K20@PROJECT_NAME@
|
19
|
|
- WORKING_DIRECTORY "$ENV{DESTDIR}/etc"
|
20
|
|
-)
|
21
|
|
-if(NOT EXISTS "$ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
|
22
|
|
- file(INSTALL "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "/etc/default" RENAME "@PROJECT_NAME@")
|
23
|
|
-else()
|
24
|
|
- message(STATUS "Keeping old version: $ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
|
25
|
|
-endif()
|
|
1
|
+set(INIT_FLAVOR "@INIT_FLAVOR@")
|
26
|
2
|
set(SECRET_FILE "@PROJECT_NAME@.secret")
|
27
|
3
|
set(DD "@DD@")
|
28
|
4
|
set(BASE64 "@BASE64@")
|
|
5
|
+set(INSSERV "@INSSERV@")
|
|
6
|
+
|
|
7
|
+if(INIT_FLAVOR AND NOT EXISTS "$ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
|
|
8
|
+ file(INSTALL "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "/etc/default" RENAME "@PROJECT_NAME@")
|
|
9
|
+endif()
|
|
10
|
+
|
|
11
|
+if(INIT_FLAVOR STREQUAL "sysv")
|
|
12
|
+ file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.init" TYPE PROGRAM DESTINATION "/etc/init.d" RENAME "@PROJECT_NAME@")
|
|
13
|
+ if(INSSERV)
|
|
14
|
+ execute_process(
|
|
15
|
+ COMMAND ${INSSERV} -p "$ENV{DESTDIR}/etc/init.d" @PROJECT_NAME@
|
|
16
|
+ )
|
|
17
|
+ endif()
|
|
18
|
+elseif(INIT_FLAVOR STREQUAL "upstart")
|
|
19
|
+ file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
|
|
20
|
+endif()
|
|
21
|
+
|
29
|
22
|
if(DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
|
30
|
23
|
message(STATUS "Generating secret key")
|
31
|
24
|
execute_process(
|
|
@@ -38,4 +31,3 @@ if(DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${S
|
38
|
31
|
file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "/etc" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
|
39
|
32
|
file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
|
40
|
33
|
endif()
|
41
|
|
-
|