瀏覽代碼

Add option to disable secret key generation

tags/1.0
Timo Röhling 12 年之前
父節點
當前提交
74cfa490e1
共有 2 個檔案被更改,包括 4 行新增1 行删除
  1. 2
    0
      CMakeLists.txt
  2. 2
    1
      postinstall.cmake.in

+ 2
- 0
CMakeLists.txt 查看文件

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

+ 2
- 1
postinstall.cmake.in 查看文件

@@ -1,3 +1,4 @@
1
+set(GENERATE_SRS_SECRET "@GENERATE_SRS_SECRET@")
1 2
 set(INIT_FLAVOR "@INIT_FLAVOR@")
2 3
 set(SECRET_FILE "@PROJECT_NAME@.secret")
3 4
 set(DD "@DD@")
@@ -19,7 +20,7 @@ elseif(INIT_FLAVOR STREQUAL "upstart")
19 20
 	file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
20 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 24
 	message(STATUS "Generating secret key")
24 25
 	execute_process(
25 26
 		COMMAND ${DD} if=/dev/urandom bs=18 count=1

Loading…
取消
儲存