From bcd144607640bfd678daeb885f8decdaed1ecb8f Mon Sep 17 00:00:00 2001 From: Federico Gustavo Galland <99492720+f-galland@users.noreply.github.com> Date: Fri, 12 Jan 2024 07:45:49 -0300 Subject: [PATCH 1/2] Remove unneeded files from assembled packages (#115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add remove files function to assemble.sh * Remove unneeded files on assembled tar packages * Remove duplicated function Fix wrong variable assignment --------- Co-authored-by: Álex Ruiz --- scripts/assemble.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/assemble.sh b/scripts/assemble.sh index 67c8842f85226..b64d987a72a04 100755 --- a/scripts/assemble.sh +++ b/scripts/assemble.sh @@ -165,6 +165,13 @@ function add_configuration_files() { find . -name "*.bat" -exec rm -rf {} \; } +# ==== +# Remove unneeded files +# ==== +function remove_unneeded_files() { + rm "$PATH_PLUGINS/opensearch-security/tools/install_demo_configuration.sh" +} + # ==== # Copy performance analyzer service file # ==== @@ -212,6 +219,7 @@ function assemble_tar() { cd "${TMP_DIR}" PATH_CONF="./config" PATH_BIN="./bin" + PATH_PLUGINS="./plugins" # Extract echo "Extract ${ARTIFACT_BUILD_NAME} archive" @@ -222,6 +230,7 @@ function assemble_tar() { install_plugins # Swap configuration files add_configuration_files + remove_unneeded_files # Pack archive_name="wazuh-indexer-$(cat VERSION)" @@ -246,6 +255,7 @@ function assemble_rpm() { local src_path="./usr/share/wazuh-indexer" PATH_CONF="./etc/wazuh-indexer" PATH_BIN="${src_path}/bin" + PATH_PLUGINS="${src_path}/plugins" # Extract min-package. Creates usr/, etc/ and var/ in the current directory echo "Extract ${ARTIFACT_BUILD_NAME} archive" @@ -256,6 +266,7 @@ function assemble_rpm() { enable_performance_analyzer_rca ${src_path} # Swap configuration files add_configuration_files + remove_unneeded_files # Generate final package local topdir @@ -295,6 +306,7 @@ function assemble_deb() { local src_path="./usr/share/wazuh-indexer" PATH_CONF="./etc/wazuh-indexer" PATH_BIN="${src_path}/bin" + PATH_PLUGINS="${src_path}/plugins" # Extract min-package. Creates usr/, etc/ and var/ in the current directory echo "Extract ${ARTIFACT_BUILD_NAME} archive" @@ -306,6 +318,7 @@ function assemble_deb() { enable_performance_analyzer_rca ${src_path} # Swap configuration files add_configuration_files + remove_unneeded_files # Generate final package local version @@ -321,7 +334,7 @@ function assemble_deb() { # Move to the root folder, copy the package and clean. cd ../../.. - package_name="wazuh-indexer_${version}_${SUFFIX}.${EXT}" + package_name="wazuh-indexer_${version}_${SUFFIX}.${EXT}" # debmake creates the package one level above cp "${TMP_DIR}/../${package_name}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME" @@ -338,9 +351,7 @@ function main() { ARTIFACT_BUILD_NAME=$(ls "${OUTPUT}/dist/" | grep "wazuh-indexer-min_.*$SUFFIX.*\.$EXT") - ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/} - - + ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/} # Create temporal directory and copy the min package there for extraction TMP_DIR="${OUTPUT}/tmp/${TARGET}" From 805addde5122d65c727ec3c0eb7c172ba61797ca Mon Sep 17 00:00:00 2001 From: Federico Gustavo Galland <99492720+f-galland@users.noreply.github.com> Date: Fri, 12 Jan 2024 08:17:17 -0300 Subject: [PATCH 2/2] Add missing tools and files back into Wazuh Indexer packages (#117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add remove files function to assemble.sh * Remove unneeded files on assembled tar packages * Remove duplicated function Fix wrong variable assignment * Adding function to package Wazuh`s tools to assemble.sh * Make the files' versions follow the repo's VERSION file * Fix download of Wazuh tools for packages assembly --------- Signed-off-by: Álex Ruiz Co-authored-by: Álex Ruiz --- scripts/assemble.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/assemble.sh b/scripts/assemble.sh index b64d987a72a04..9f25c304808b4 100755 --- a/scripts/assemble.sh +++ b/scripts/assemble.sh @@ -172,6 +172,21 @@ function remove_unneeded_files() { rm "$PATH_PLUGINS/opensearch-security/tools/install_demo_configuration.sh" } +# ==== +# Add additional tools into packages +# ==== +function add_wazuh_tools() { + local version + version=$(