Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded files from assembled packages #115

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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