Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

postinstall.cmake.in 1.3KB

12345678910111213141516171819202122232425262728293031323334
  1. set(GENERATE_SRS_SECRET "@GENERATE_SRS_SECRET@")
  2. set(INIT_FLAVOR "@INIT_FLAVOR@")
  3. set(SECRET_FILE "@PROJECT_NAME@.secret")
  4. set(DD "@DD@")
  5. set(BASE64 "@BASE64@")
  6. set(INSSERV "@INSSERV@")
  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. if(INIT_FLAVOR STREQUAL "sysv")
  11. file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.init" TYPE PROGRAM DESTINATION "/etc/init.d" RENAME "@PROJECT_NAME@")
  12. if(INSSERV)
  13. execute_process(
  14. COMMAND ${INSSERV} -p "$ENV{DESTDIR}/etc/init.d" @PROJECT_NAME@
  15. )
  16. endif()
  17. elseif(INIT_FLAVOR STREQUAL "upstart")
  18. file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
  19. endif()
  20. if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
  21. message(STATUS "Generating secret key")
  22. execute_process(
  23. COMMAND ${DD} if=/dev/urandom bs=18 count=1
  24. COMMAND ${BASE64} -w0
  25. OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
  26. ERROR_QUIET
  27. OUTPUT_STRIP_TRAILING_WHITESPACE
  28. )
  29. file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "/etc" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
  30. file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
  31. endif()