Skip to content

Commit

Permalink
Add missing tools and files back into Wazuh Indexer packages (#117)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
  • Loading branch information
f-galland and AlexRuiz7 committed Jun 28, 2024
1 parent ceebf3f commit b3c2161
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions scripts/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$(<VERSION)
version=${version%%.[[:digit:]]}
local download_url
download_url="https://packages-dev.wazuh.com/${version}"

wget -q "${download_url}/config.yml" -O $PATH_PLUGINS/opensearch-security/tools/config.yml
wget -q "${download_url}/wazuh-passwords-tool.sh "-O $PATH_PLUGINS/opensearch-security/tools/wazuh-passwords-tool.sh
wget -q "${download_url}/wazuh-certs-tool.sh" -O $PATH_PLUGINS/opensearch-security/tools/wazuh-certs-tool.sh
}

# ====
# Copy performance analyzer service file
# ====
Expand Down Expand Up @@ -231,6 +246,7 @@ function assemble_tar() {
# Swap configuration files
add_configuration_files
remove_unneeded_files
add_wazuh_tools

# Pack
archive_name="wazuh-indexer-$(cat VERSION)"
Expand Down Expand Up @@ -267,14 +283,14 @@ function assemble_rpm() {
# Swap configuration files
add_configuration_files
remove_unneeded_files
add_wazuh_tools

# Generate final package
local topdir
local version
local spec_file="wazuh-indexer.rpm.spec"
topdir=$(pwd)
version=$(cat ./usr/share/wazuh-indexer/VERSION)
# TODO validate architecture
rpmbuild --bb \
--define "_topdir ${topdir}" \
--define "_version ${version}" \
Expand All @@ -283,9 +299,7 @@ function assemble_rpm() {

# Move to the root folder, copy the package and clean.
cd ../../..

package_name="wazuh-indexer-${version}-1.${SUFFIX}.${EXT}"

cp "${TMP_DIR}/RPMS/${SUFFIX}/${package_name}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME"

clean
Expand Down Expand Up @@ -319,6 +333,7 @@ function assemble_deb() {
# Swap configuration files
add_configuration_files
remove_unneeded_files
add_wazuh_tools

# Generate final package
local version
Expand Down

0 comments on commit b3c2161

Please sign in to comment.