Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

postinstall.cmake.in 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. set(GENERATE_SRS_SECRET "@GENERATE_SRS_SECRET@")
  2. set(SYSCONF_DIR "@SYSCONF_DIR@")
  3. set(CHROOT_DIR "@CHROOT_DIR@")
  4. set(CONFIG_DIR "@CONFIG_DIR@")
  5. set(INIT_FLAVOR "@INIT_FLAVOR@")
  6. set(SECRET_FILE "@PROJECT_NAME@.secret")
  7. set(DD "@DD@")
  8. set(BASE64 "@BASE64@")
  9. set(INSSERV "@INSSERV@")
  10. set(CHKCONFIG "@CHKCONFIG@")
  11. if(CHROOT_DIR AND NOT EXISTS "$ENV{DESTDIR}${CHROOT_DIR}")
  12. message(STATUS "Chroot jail: $ENV{DESTDIR}${CHROOT_DIR}")
  13. file(MAKE_DIRECTORY "$ENV{DESTDIR}${CHROOT_DIR}")
  14. endif()
  15. if(INIT_FLAVOR AND NOT EXISTS "$ENV{DESTDIR}${CONFIG_DIR}/@PROJECT_NAME@")
  16. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.default" DESTINATION "${CONFIG_DIR}" RENAME "@PROJECT_NAME@")
  17. endif()
  18. if(INIT_FLAVOR STREQUAL "sysv-lsb")
  19. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.sysv-lsb" TYPE PROGRAM DESTINATION "${SYSCONF_DIR}/init.d" RENAME "@PROJECT_NAME@")
  20. if(INSSERV)
  21. execute_process(
  22. COMMAND ${INSSERV} -p "$ENV{DESTDIR}${SYSCONF_DIR}/init.d" @PROJECT_NAME@
  23. )
  24. endif()
  25. elseif(INIT_FLAVOR STREQUAL "sysv-redhat")
  26. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.sysv-redhat" TYPE PROGRAM DESTINATION "${SYSCONF_DIR}/init.d" RENAME "@PROJECT_NAME@")
  27. if(CHKCONFIG AND NOT "$ENV{DESTDIR}")
  28. execute_process(
  29. COMMAND ${CHKCONFIG} --add @PROJECT_NAME@
  30. )
  31. endif()
  32. elseif(INIT_FLAVOR STREQUAL "upstart")
  33. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "${SYSCONF_DIR}/init" RENAME "@PROJECT_NAME@.conf")
  34. elseif(INIT_FLAVOR STREQUAL "systemd")
  35. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.systemd" DESTINATION "${SYSCONF_DIR}/systemd/system" RENAME "@PROJECT_NAME@.service")
  36. endif()
  37. if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")
  38. message(STATUS "Generating secret key")
  39. execute_process(
  40. COMMAND ${DD} if=/dev/urandom bs=18 count=1
  41. COMMAND ${BASE64}
  42. OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
  43. ERROR_QUIET
  44. OUTPUT_STRIP_TRAILING_WHITESPACE
  45. )
  46. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "${SYSCONF_DIR}" RENAME "${SECRET_FILE}" PERMISSIONS OWNER_READ OWNER_WRITE)
  47. file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
  48. endif()