Просмотр исходного кода

Use openssl binary of no base64 binary is available

Suggested by maxfieb (#21)
tags/1.3
Timo Röhling 10 лет назад
Родитель
Сommit
1d1c8f46e8
2 измененных файлов: 12 добавлений и 3 удалений
  1. 9
    0
      CMakeLists.txt
  2. 3
    3
      postinstall.cmake.in

+ 9
- 0
CMakeLists.txt Просмотреть файл

@@ -13,11 +13,20 @@ set(DOC_DIR "share/doc/${PROJECT_NAME}" CACHE PATH "Path for documentation files
13 13
 find_program(HELP2MAN help2man DOC "path to help2man executable")
14 14
 find_program(DD dd DOC "path to dd executable")
15 15
 find_program(BASE64 base64 DOC "path to base64 executable")
16
+find_program(OPENSSL openssl DOC "path to OpenSSL executable")
16 17
 find_program(INSSERV insserv DOC "path to insserv executable")
17 18
 find_program(CHKCONFIG chkconfig DOC "path to chkconfig executable")
18 19
 find_library(LIBSOCKET socket)
19 20
 find_library(LIBNSL nsl)
20 21
 
22
+if(BASE64)
23
+    set(BASE64_ENCODE "${BASE64}")
24
+elseif(OPENSSL)
25
+    set(BASE64_ENCODE "${OPENSSL} base64 -e")
26
+else()
27
+    set(BASE64_ENCODE "")
28
+endif()
29
+
21 30
 check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
22 31
 if(HAVE_SYS_WAIT_H)
23 32
     add_definitions(-DHAVE_SYS_WAIT_H)

+ 3
- 3
postinstall.cmake.in Просмотреть файл

@@ -5,7 +5,7 @@ set(CONFIG_DIR "@CONFIG_DIR@")
5 5
 set(INIT_FLAVOR "@INIT_FLAVOR@")
6 6
 set(SECRET_FILE "@PROJECT_NAME@.secret")
7 7
 set(DD "@DD@")
8
-set(BASE64 "@BASE64@")
8
+set(BASE64_ENCODE "@BASE64_ENCODE@")
9 9
 set(INSSERV "@INSSERV@")
10 10
 set(CHKCONFIG "@CHKCONFIG@")
11 11
 
@@ -38,11 +38,11 @@ elseif(INIT_FLAVOR STREQUAL "systemd")
38 38
 	file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.systemd" DESTINATION "${SYSCONF_DIR}/systemd/system" RENAME "@PROJECT_NAME@.service")
39 39
 endif()
40 40
 
41
-if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")
41
+if(GENERATE_SRS_SECRET AND DD AND BASE64_ENCODE AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")
42 42
 	message(STATUS "Generating secret key")
43 43
 	execute_process(
44 44
 		COMMAND ${DD} if=/dev/urandom bs=18 count=1
45
-		COMMAND ${BASE64}
45
+                COMMAND ${BASE64_ENCODE}
46 46
 		OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
47 47
 		ERROR_QUIET
48 48
 		OUTPUT_STRIP_TRAILING_WHITESPACE

Загрузка…
Отмена
Сохранить