Skip to content

Commit

Permalink
Changed way to get version in DEB and added certs download
Browse files Browse the repository at this point in the history
  • Loading branch information
okynos committed Jan 14, 2022
1 parent 2308dc7 commit 064725a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
9 changes: 3 additions & 6 deletions indexer/deb/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ if [ "${future}" = "yes" ];then
version="99.99.0"
else
if [ "${spec_reference}" ];then
version=$(curl -sL https://raw.githubusercontent.com/wazuh/wazuh-packages/${spec_reference}/indexer/deb/debian/changelog | egrep -o -m 1 '[0-9]+\.[0-9]+\.[0-9]+')
version=$(curl -sL https://raw.githubusercontent.com/wazuh/wazuh-packages/${spec_reference}/VERSION | cat)
else
version=$(egrep -o -m 1 '[0-9]+\.[0-9]+\.[0-9]+' /root/indexer/deb/debian/changelog)
version=$(cat /root/VERSION)
fi
fi

Expand All @@ -48,14 +48,11 @@ else
cp -r /root/indexer/deb/debian/* ${sources_dir}/debian/
fi

if [ "${future}" = "yes" ];then
sed -i '1s|[0-9]\+.[0-9]\+.[0-9]\+-RELEASE|99.99.0-RELEASE|' ${sources_dir}/debian/changelog
fi

# Generating directory structure to build the .deb package
cd ${build_dir}/${target} && tar -czf ${pkg_name}.orig.tar.gz "${pkg_name}"

# Configure the package with the different parameters
sed -i "s:VERSION:${version}:g" ${sources_dir}/debian/changelog
sed -i "s:RELEASE:${release}:g" ${sources_dir}/debian/changelog
sed -i "s:export INSTALLATION_DIR=.*:export INSTALLATION_DIR=${directory_base}:g" ${sources_dir}/debian/rules

Expand Down
2 changes: 1 addition & 1 deletion indexer/deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wazuh-indexer (4.3.0-RELEASE) unstable; urgency=low
wazuh-indexer (VERSION-RELEASE) unstable; urgency=low

* More info: https://documentation.wazuh.com/current/release-notes/

Expand Down
12 changes: 11 additions & 1 deletion indexer/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ override_dh_auto_install:
override_dh_install:
rm -rf $(INSTALLATION_DIR)/

curl -o $(INDEXER_FILE) https://s3.amazonaws.com/warehouse.wazuh.com/indexer/$(INDEXER_FILE)
curl -o $(INDEXER_FILE) https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/$(INDEXER_FILE)
tar -zvxf $(INDEXER_FILE)

# copy to target
Expand All @@ -88,6 +88,16 @@ override_dh_install:
# Copy installation files to final location
cp -pr $(BASE_DIR)/* $(TARGET_DIR)$(INSTALLATION_DIR)

# Download demo certificates
curl -kOL https://s3.amazonaws.com/warehouse.wazuh.com/stack/demo-certs.tar.gz
tar xzvf demo-certs.tar.gz && rm -f demo-certs.tar.gz
mkdir -p $(TARGET_DIR)$(CONFIG_DIR)/certs/
cp certs/admin.pem $(TARGET_DIR)$(CONFIG_DIR)/certs/
cp certs/admin-key.pem $(TARGET_DIR)$(CONFIG_DIR)/certs/
cp certs/demo-indexer.pem $(TARGET_DIR)$(CONFIG_DIR)/certs/
cp certs/demo-indexer-key.pem $(TARGET_DIR)$(CONFIG_DIR)/certs/
cp certs/root-ca.pem $(TARGET_DIR)$(CONFIG_DIR)/certs/

# Copy the security tools
cp $(REPO_DIR)/install_functions/wazuh-cert-tool.sh $(TARGET_DIR)$(INSTALLATION_DIR)/plugins/opensearch-security/tools/
cp $(REPO_DIR)/install_functions/wazuh-passwords-tool.sh $(TARGET_DIR)$(INSTALLATION_DIR)/plugins/opensearch-security/tools/
Expand Down

0 comments on commit 064725a

Please sign in to comment.