1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- set(GENERATE_SRS_SECRET "@GENERATE_SRS_SECRET@")
- set(SYSCONF_DIR "@SYSCONF_DIR@")
- set(CHROOT_DIR "@CHROOT_DIR@")
- set(CONFIG_DIR "@CONFIG_DIR@")
- set(INIT_FLAVOR "@INIT_FLAVOR@")
- set(SECRET_FILE "@PROJECT_NAME@.secret")
- set(DD "@DD@")
- set(BASE64 "@BASE64@")
- set(INSSERV "@INSSERV@")
- set(CHKCONFIG "@CHKCONFIG@")
-
- if(CHROOT_DIR AND NOT EXISTS "$ENV{DESTDIR}${CHROOT_DIR}")
- message(STATUS "Chroot jail: $ENV{DESTDIR}${CHROOT_DIR}")
- file(MAKE_DIRECTORY "$ENV{DESTDIR}${CHROOT_DIR}")
- endif()
-
- if(INIT_FLAVOR AND NOT EXISTS "$ENV{DESTDIR}${CONFIG_DIR}/@PROJECT_NAME@")
- file(INSTALL FILES "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "${CONFIG_DIR}" RENAME "@PROJECT_NAME@")
- endif()
-
- if(INIT_FLAVOR STREQUAL "sysv-lsb")
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.lsb_init" TYPE PROGRAM DESTINATION "${SYSCONF_DIR}/init.d" RENAME "@PROJECT_NAME@")
- if(INSSERV)
- execute_process(
- COMMAND ${INSSERV} -p "$ENV{DESTDIR}${SYSCONF_DIR}/init.d" @PROJECT_NAME@
- )
- endif()
- elseif(INIT_FLAVOR STREQUAL "sysv-redhat")
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.rh_init" TYPE PROGRAM DESTINATION "${SYSCONF_DIR}/init.d" RENAME "@PROJECT_NAME@")
- if(CHKCONFIG AND NOT "$ENV{DESTDIR}")
- execute_process(
- COMMAND ${CHKCONFIG} --add @PROJECT_NAME@
- )
- endif()
- elseif(INIT_FLAVOR STREQUAL "upstart")
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "${SYSCONF_DIR}/init" RENAME "@PROJECT_NAME@.conf")
- endif()
-
- if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}${SYSCONF_DIR}/${SECRET_FILE}")
- message(STATUS "Generating secret key")
- execute_process(
- COMMAND ${DD} if=/dev/urandom bs=18 count=1
- COMMAND ${BASE64}
- OUTPUT_FILE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}"
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "${SYSCONF_DIR}" RENAME "${SECRET_FILE}" PERMISSIONS OWNER_READ OWNER_WRITE)
- file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
- endif()
|