Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

postinstall.cmake.in 1.9KB

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