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

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