Skip to content

Commit

Permalink
Update script build all packages
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Dec 4, 2023
1 parent c36ffd4 commit 2a90fb5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
4 changes: 3 additions & 1 deletion dev-tools/build-packages/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ build() {
echo Compressing the package...
echo
cd ..
mkdir -p $out_dir
if [ ! -d "$out_dir" ]; then
mkdir -p $out_dir
fi
tar -czvf $out_dir/$working_dir.tar.gz $working_dir

echo
Expand Down
28 changes: 22 additions & 6 deletions dev-tools/build-packages/build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ current_path="$( cd $(dirname $0) ; pwd -P )"
build_tar() {
echo "Building tar package..."
cd ./base
# bash ./generate_base.sh -a $app -b $base -s $security -v $version -r $revision
bash ./generate_base.sh -a $app -b $base -s $security -v $version -r $revision

name_package_tar = $(ls ./output)
name_package_tar=$(ls ./output)

if [ "$tar" == "yes" ]; then
echo $(pwd)
echo "Moving tar package to $output"
mv $current_path/base/output/$name_package_tar $output/$name_package_tar
fi
cd ../
Expand All @@ -30,14 +30,19 @@ build_tar() {
build_deb() {
echo "Building deb package..."
cd ./deb
# bash ./launcher.sh -v $version -r $revision -p file://$current_path/base/output/$name_package_tar
bash ./launcher.sh -v $version -r $revision -p file://$output/$name_package_tar
name_package_tar=$(ls ./output)
echo "Moving deb package to $output/deb"
mv $current_path/deb/output $output/deb
cd ../
}

build_rpm() {
echo "Building rpm package..."
cd ./rpm
# bash ./launcher.sh -v $version -r $revision -p file://$current_path/base/output/$name_package_tar
bash ./launcher.sh -v $version -r $revision -p file://$output/$name_package_tar
echo "Moving rpm package to $output/rpm"
mv $current_path/rpm/output $output/rpm
cd ../
}

Expand All @@ -46,7 +51,7 @@ build() {
name_package_tar="wazuh-dashboard-$version-$revision-linux-x64.tar.gz"

if [ ! -d "$output" ]; then
mkdir -p $output
mkdir $output
fi

if [ "$all_platforms" == "yes" ]; then
Expand All @@ -67,6 +72,11 @@ build() {
echo "Building rpm package..."
build_rpm
fi

if [ "$tar" == "no" ]; then
echo "Removing tar package..."
rm -r $current_path/base/output
fi
}

help() {
Expand Down Expand Up @@ -164,6 +174,12 @@ main() {
done

if [ -z "$app" ] | [ -z "$base" ] | [ -z "$security" ] | [ -z "$version" ]; then
echo "You must specify the app, base, security and version."
help 1
fi

if [ "$all_platforms" == "no" ] && [ "$deb" == "no" ] && [ "$rpm" == "no" ] && [ "$tar" == "no" ]; then
echo "You must specify at least one package to build."
help 1
fi

Expand Down
4 changes: 3 additions & 1 deletion dev-tools/build-packages/deb/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ build_deb() {
fi

# Build the Debian package with a Docker container
mkdir -p $out_dir
if [ ! -d "$out_dir" ]; then
mkdir -p $out_dir
fi
volumes="-v ${out_dir}/:/tmp:Z -v ${tmp_dir}/wazuh-dashboard.tar.gz:/opt/wazuh-dashboard.tar.gz"
docker run -t --rm ${volumes} \
-v ${current_path}/../..:/root:Z \
Expand Down
5 changes: 4 additions & 1 deletion dev-tools/build-packages/rpm/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ build_rpm() {
fi

# Build the RPM package with a Docker container
mkdir -p $out_dir

if [ ! -d "$out_dir" ]; then
mkdir -p $out_dir
fi
volumes="-v ${out_dir}/:/tmp:Z -v ${tmp_dir}/wazuh-dashboard.tar.gz:/opt/wazuh-dashboard.tar.gz"
docker run -t --rm ${volumes} \
-v ${current_path}/../..:/root:Z \
Expand Down

0 comments on commit 2a90fb5

Please sign in to comment.