Skip to content

Commit

Permalink
Remove unneeded files from assembled packages (#115)
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

---------

Co-authored-by: Álex Ruiz <[email protected]>
  • Loading branch information
f-galland and AlexRuiz7 committed Jan 16, 2024
1 parent 9d909b0 commit efda221
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions scripts/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ====
Expand Down Expand Up @@ -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"
Expand All @@ -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)"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"

Expand All @@ -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}"
Expand Down

0 comments on commit efda221

Please sign in to comment.