Skip to content

Commit

Permalink
Put template download command within a function
Browse files Browse the repository at this point in the history
  • Loading branch information
f-galland committed Jan 17, 2024
1 parent 9c6bb78 commit a246f0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 0 additions & 4 deletions distribution/packages/src/rpm/wazuh-indexer.rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ exit 0

# Wazuh additional files
%attr(440, %{name}, %{name}) %{product_dir}/VERSION
## Removing as %{product_dir}/bin is included in line 199
# %attr(750, %{name}, %{name}) %{product_dir}/bin/indexer-security-init.sh
# %attr(750, %{name}, %{name}) %{product_dir}/bin/indexer-ism-init.sh
# %attr(750, %{name}, %{name}) %{product_dir}/bin/indexer-init.sh
%attr(660, %{name}, %{name}) %{config_dir}/wazuh-template.json

%changelog
Expand Down
19 changes: 17 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fi

[ -z "$OUTPUT" ] && OUTPUT=artifacts


echo "Creating output directory $OUTPUT/maven/org/opensearch if it doesn't already exist"
mkdir -p "$OUTPUT/maven/org/opensearch"

Expand All @@ -101,6 +102,21 @@ cp -r ./build/local-test-repo/org/opensearch "${OUTPUT}"/maven/org
[ -z "$REVISION" ] && REVISION="1"
[ -z "$BRANCH" ] && BRANCH="master"

function download_template()
{
echo "Downloading wazuh-template.json"
local download_url
download_url='https://raw.githubusercontent.com/wazuh/wazuh/$BRANCH/extensions/elasticsearch/7.x/'
curl -s ${download_url}wazuh-template.json -o distribution/src/config/wazuh-template.json

if [ $? -ne 0 ]; then
echo "Unable to download wazuh-template.json"
exit 1
fi

echo "Successfully downloaded wazuh-template.json"
}

case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in
linux-tar-x64|darwin-tar-x64)
PACKAGE="tar"
Expand Down Expand Up @@ -166,8 +182,7 @@ esac

echo "Building OpenSearch for $PLATFORM-$DISTRIBUTION-$ARCHITECTURE"


wget -q https://raw.githubusercontent.com/wazuh/wazuh/$BRANCH/extensions/elasticsearch/7.x/wazuh-template.json -O distribution/src/config/wazuh-template.json
download_template

./gradlew ":distribution:$TYPE:$TARGET:assemble" -Dbuild.snapshot="$SNAPSHOT" -Dbuild.version_qualifier="$QUALIFIER"

Expand Down

0 comments on commit a246f0b

Please sign in to comment.