Browse Source

Add option to disable secret key generation

tags/1.0
Timo Röhling 12 years ago
parent
commit
74cfa490e1
2 changed files with 4 additions and 1 deletions
  1. 2
    0
      CMakeLists.txt
  2. 2
    1
      postinstall.cmake.in

+ 2
- 0
CMakeLists.txt View File

1
 cmake_minimum_required(VERSION 2.8)
1
 cmake_minimum_required(VERSION 2.8)
2
 project(postsrsd C)
2
 project(postsrsd C)
3
 
3
 
4
+option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
5
+
4
 find_program(HELP2MAN help2man DOC "path to help2man executable")
6
 find_program(HELP2MAN help2man DOC "path to help2man executable")
5
 find_program(DD dd DOC "path to dd executable")
7
 find_program(DD dd DOC "path to dd executable")
6
 find_program(BASE64 base64 DOC "path to base64 executable")
8
 find_program(BASE64 base64 DOC "path to base64 executable")

+ 2
- 1
postinstall.cmake.in View File

1
+set(GENERATE_SRS_SECRET "@GENERATE_SRS_SECRET@")
1
 set(INIT_FLAVOR "@INIT_FLAVOR@")
2
 set(INIT_FLAVOR "@INIT_FLAVOR@")
2
 set(SECRET_FILE "@PROJECT_NAME@.secret")
3
 set(SECRET_FILE "@PROJECT_NAME@.secret")
3
 set(DD "@DD@")
4
 set(DD "@DD@")
19
 	file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
20
 	file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
20
 endif()
21
 endif()
21
 
22
 
22
-if(DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
23
+if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
23
 	message(STATUS "Generating secret key")
24
 	message(STATUS "Generating secret key")
24
 	execute_process(
25
 	execute_process(
25
 		COMMAND ${DD} if=/dev/urandom bs=18 count=1
26
 		COMMAND ${DD} if=/dev/urandom bs=18 count=1

Loading…
Cancel
Save