Ensure presence of Zeek-related directories in toplevel CMakeLists.txt

This establishes several of the Zeek installation's directories in
CMakeLists.txt, and adds a new ZEEK_STATE_DIR (via `configure --state-dir`) for
arbitrary Zeek-related variable state. It defaults to ZEEK_ROOT/var/lib.

This leaves the existing, zeekctl-related ZEEK_LOCAL_STATE_DIR unchanged and
does not use it. We'll likely deprecate it when removal of zeekctl approaches.
This commit is contained in:
Christian Kreibich 2022-05-23 13:28:21 -07:00
parent 4d1b9f4a08
commit 9860b5686d
2 changed files with 36 additions and 7 deletions

View file

@ -65,6 +65,27 @@ else ()
CACHE STRING "Installation path for plugins" FORCE)
endif ()
if ( NOT ZEEK_ETC_INSTALL_DIR )
set(ZEEK_ETC_INSTALL_DIR ${ZEEK_ROOT_DIR}/etc)
endif ()
if ( NOT ZEEK_STATE_DIR )
set(ZEEK_STATE_DIR ${ZEEK_ROOT_DIR}/var/lib)
endif ()
if ( NOT ZEEK_SPOOL_DIR )
set(ZEEK_SPOOL_DIR ${ZEEK_ROOT_DIR}/spool)
endif ()
if ( NOT ZEEK_LOG_DIR )
set(ZEEK_LOG_DIR ${ZEEK_ROOT_DIR}/logs)
endif ()
install(DIRECTORY DESTINATION ${ZEEK_ETC_INSTALL_DIR})
install(DIRECTORY DESTINATION ${ZEEK_STATE_DIR})
install(DIRECTORY DESTINATION ${ZEEK_SPOOL_DIR})
install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR})
configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev)
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink
"${CMAKE_CURRENT_BINARY_DIR}/zeek-wrapper.in"
@ -612,7 +633,7 @@ if ( INSTALL_ZKG )
# An etc/zkg directory for zkg's config file simplifies zkg's
# config file code.
set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg")
set(ZEEK_ZKG_STATE_DIR "${ZEEK_ROOT_DIR}/var/lib/zkg")
set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in
@ -768,10 +789,16 @@ message(
"\n"
"\nBuild type: ${CMAKE_BUILD_TYPE}"
"\nBuild dir: ${PROJECT_BINARY_DIR}"
"\n"
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}"
"\nConfig file dir: ${ZEEK_ETC_INSTALL_DIR}"
"\nLog dir: ${ZEEK_LOG_DIR}"
"\nPlugin dir: ${BRO_PLUGIN_INSTALL_PATH}"
"\nPython module dir: ${PY_MOD_INSTALL_DIR}"
"\nZeek Script Path: ${ZEEK_SCRIPT_INSTALL_PATH}"
"\nScript dir: ${ZEEK_SCRIPT_INSTALL_PATH}"
"\nSpool dir: ${ZEEK_SPOOL_DIR}"
"\nState dir: ${ZEEK_STATE_DIR}"
"\n"
"\nDebug mode: ${ENABLE_DEBUG}"
"\nUnit tests: ${ENABLE_ZEEK_UNIT_TESTS}"
"\nBuiltin Plugins: ${ZEEK_BUILTIN_PLUGINS}"