選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

postinstall.cmake.in 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. message(STATUS "Updating RC: $ENV{DESTDIR}/etc/init.d/@PROJECT_NAME@")
  2. file(MAKE_DIRECTORY
  3. "$ENV{DESTDIR}/etc/rc0.d"
  4. "$ENV{DESTDIR}/etc/rc1.d"
  5. "$ENV{DESTDIR}/etc/rc2.d"
  6. "$ENV{DESTDIR}/etc/rc3.d"
  7. "$ENV{DESTDIR}/etc/rc4.d"
  8. "$ENV{DESTDIR}/etc/rc5.d"
  9. "$ENV{DESTDIR}/etc/rc6.d"
  10. )
  11. execute_process(
  12. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc0.d/K20@PROJECT_NAME@
  13. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc1.d/K20@PROJECT_NAME@
  14. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc2.d/S20@PROJECT_NAME@
  15. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc3.d/S20@PROJECT_NAME@
  16. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc4.d/S20@PROJECT_NAME@
  17. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc5.d/S20@PROJECT_NAME@
  18. COMMAND ln -sf ../init.d/@PROJECT_NAME@ rc6.d/K20@PROJECT_NAME@
  19. WORKING_DIRECTORY "$ENV{DESTDIR}/etc"
  20. )
  21. if(NOT EXISTS "$ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
  22. file(INSTALL "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "/etc/default" RENAME "@PROJECT_NAME@")
  23. else()
  24. message(STATUS "Keeping old version: $ENV{DESTDIR}/etc/default/@PROJECT_NAME@")
  25. endif()
  26. set(SECRET_FILE "@PROJECT_NAME@.secret")
  27. set(DD "@DD@")
  28. set(BASE64 "@BASE64@")
  29. if(DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
  30. message(STATUS "Generating secret key")
  31. execute_process(
  32. COMMAND ${DD} if=/dev/urandom bs=18 count=1
  33. COMMAND ${BASE64} -w0
  34. OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
  35. ERROR_QUIET
  36. OUTPUT_STRIP_TRAILING_WHITESPACE
  37. )
  38. file(INSTALL "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "/etc" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
  39. file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
  40. endif()