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.9KB

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