From d7da320b7a57cfdc689971e3ecfa4e9d4be2a5bf Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Tue, 9 Apr 2024 09:34:38 +0200 Subject: [PATCH] chore(scripts): dynamically set falcoctl allowed driver types based on cmake configuration. Signed-off-by: Federico Di Pierro --- scripts/CMakeLists.txt | 11 +++++++++++ scripts/falcoctl/falcoctl.yaml.in | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 9aa72a8a536..6fddd418c42 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -47,7 +47,18 @@ endif() if (NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT MUSL_OPTIMIZED_BUILD) if(NOT DEFINED FALCOCTL_ETC_DIR) set(FALCOCTL_ETC_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/falcoctl") + endif() + set(FALCOCTL_DRIVER_TYPES_LIST "") + if (BUILD_FALCO_MODERN_BPF) + list(APPEND FALCOCTL_DRIVER_TYPES_LIST "modern_ebpf") endif() + if (BUILD_BPF) + list(APPEND FALCOCTL_DRIVER_TYPES_LIST "ebpf") + endif() + if (BUILD_DRIVER) + list(APPEND FALCOCTL_DRIVER_TYPES_LIST "kmod") + endif() + string(REPLACE ";" ", " FALCOCTL_DRIVER_TYPES "${FALCOCTL_DRIVER_TYPES_LIST}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/falcoctl/falcoctl.yaml.in ${PROJECT_BINARY_DIR}/scripts/falcoctl/falcoctl.yaml) install(FILES ${PROJECT_BINARY_DIR}/scripts/falcoctl/falcoctl.yaml DESTINATION "${FALCOCTL_ETC_DIR}" COMPONENT "${FALCO_COMPONENT_NAME}") endif() diff --git a/scripts/falcoctl/falcoctl.yaml.in b/scripts/falcoctl/falcoctl.yaml.in index f9673dae60a..36ed202337d 100644 --- a/scripts/falcoctl/falcoctl.yaml.in +++ b/scripts/falcoctl/falcoctl.yaml.in @@ -1,8 +1,5 @@ driver: - type: - - "modern_ebpf" - - "ebpf" - - "kmod" + type: [@FALCOCTL_DRIVER_TYPES@] name: "@DRIVER_NAME@" repos: - "@DRIVERS_REPO@"