Skip to content

Commit efda221

Browse files
f-gallandAlexRuiz7
andcommitted
Remove unneeded files from assembled packages (#115)
* 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]>
1 parent 9d909b0 commit efda221

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

scripts/assemble.sh

+15-4
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function add_configuration_files() {
165165
find . -name "*.bat" -exec rm -rf {} \;
166166
}
167167

168+
# ====
169+
# Remove unneeded files
170+
# ====
171+
function remove_unneeded_files() {
172+
rm "$PATH_PLUGINS/opensearch-security/tools/install_demo_configuration.sh"
173+
}
174+
168175
# ====
169176
# Copy performance analyzer service file
170177
# ====
@@ -212,6 +219,7 @@ function assemble_tar() {
212219
cd "${TMP_DIR}"
213220
PATH_CONF="./config"
214221
PATH_BIN="./bin"
222+
PATH_PLUGINS="./plugins"
215223

216224
# Extract
217225
echo "Extract ${ARTIFACT_BUILD_NAME} archive"
@@ -222,6 +230,7 @@ function assemble_tar() {
222230
install_plugins
223231
# Swap configuration files
224232
add_configuration_files
233+
remove_unneeded_files
225234

226235
# Pack
227236
archive_name="wazuh-indexer-$(cat VERSION)"
@@ -246,6 +255,7 @@ function assemble_rpm() {
246255
local src_path="./usr/share/wazuh-indexer"
247256
PATH_CONF="./etc/wazuh-indexer"
248257
PATH_BIN="${src_path}/bin"
258+
PATH_PLUGINS="${src_path}/plugins"
249259

250260
# Extract min-package. Creates usr/, etc/ and var/ in the current directory
251261
echo "Extract ${ARTIFACT_BUILD_NAME} archive"
@@ -256,6 +266,7 @@ function assemble_rpm() {
256266
enable_performance_analyzer_rca ${src_path}
257267
# Swap configuration files
258268
add_configuration_files
269+
remove_unneeded_files
259270

260271
# Generate final package
261272
local topdir
@@ -295,6 +306,7 @@ function assemble_deb() {
295306
local src_path="./usr/share/wazuh-indexer"
296307
PATH_CONF="./etc/wazuh-indexer"
297308
PATH_BIN="${src_path}/bin"
309+
PATH_PLUGINS="${src_path}/plugins"
298310

299311
# Extract min-package. Creates usr/, etc/ and var/ in the current directory
300312
echo "Extract ${ARTIFACT_BUILD_NAME} archive"
@@ -306,6 +318,7 @@ function assemble_deb() {
306318
enable_performance_analyzer_rca ${src_path}
307319
# Swap configuration files
308320
add_configuration_files
321+
remove_unneeded_files
309322

310323
# Generate final package
311324
local version
@@ -321,7 +334,7 @@ function assemble_deb() {
321334

322335
# Move to the root folder, copy the package and clean.
323336
cd ../../..
324-
package_name="wazuh-indexer_${version}_${SUFFIX}.${EXT}"
337+
package_name="wazuh-indexer_${version}_${SUFFIX}.${EXT}"
325338
# debmake creates the package one level above
326339
cp "${TMP_DIR}/../${package_name}" "${OUTPUT}/dist/$ARTIFACT_PACKAGE_NAME"
327340

@@ -338,9 +351,7 @@ function main() {
338351

339352
ARTIFACT_BUILD_NAME=$(ls "${OUTPUT}/dist/" | grep "wazuh-indexer-min_.*$SUFFIX.*\.$EXT")
340353

341-
ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/}
342-
343-
354+
ARTIFACT_PACKAGE_NAME=${ARTIFACT_BUILD_NAME/min_/}
344355

345356
# Create temporal directory and copy the min package there for extraction
346357
TMP_DIR="${OUTPUT}/tmp/${TARGET}"

0 commit comments

Comments
 (0)