Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

postinstall.cmake.in 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_SOURCE_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@.lsb_init" 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@.rh_init" 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. endif()
  35. if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")
  36. message(STATUS "Generating secret key")
  37. execute_process(
  38. COMMAND ${DD} if=/dev/urandom bs=18 count=1
  39. COMMAND ${BASE64}
  40. OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
  41. ERROR_QUIET
  42. OUTPUT_STRIP_TRAILING_WHITESPACE
  43. )
  44. file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "${SYSCONF_DIR}" RENAME "${SECRET_FILE}" PERMISSIONS OWNER_READ OWNER_WRITE)
  45. file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
  46. endif()