This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
forked from Toktik-Team/toktik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all.sh
executable file
·62 lines (48 loc) · 1.54 KB
/
build-all.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Exit if any error occured
set -euxo pipefail
SERVICE_DIR=$(pwd)/service
# Remove the output directory
echo "Removing previous output directory..."
rm -rf output
# Create the output directory and binaries directory
echo "Creating output directory..."
mkdir -p output/bin
# Navigate to the service directory
echo "Navigating to service directory..."
cd $SERVICE_DIR || exit
# Loop through all directories in the service directory
for d in */ ; do
echo "Building $d..."
# Navigate into the current directory
cd "$SERVICE_DIR/$d"
# Remove the output directory
echo "Removing previous output directory..."
rm -rf output
# Create the output directory
echo "Creating output directory..."
mkdir output
# Check if the build.sh file exists, if not, skip the current directory
if [ ! -f build.sh ]; then
echo "build.sh file not found in $d, skipping..."
continue
fi
# Execute the build.sh script
echo "Executing build.sh..."
if ! bash build.sh;
then
echo "Build failed"
exit 1
fi
# Copy the binary to the output/binaries directory
echo "Copying binary to output/bin..."
cp output/bin/"$(basename "$d")" ../../output/bin/
# Check if the bootstrap.sh file exists
if [ -f output/bootstrap.sh ]; then
echo "bootstrap.sh file found in $d, copying to output directory..."
# Rename the bootstrap.sh file and copy it to the output directory
mv output/bootstrap.sh ../../output/bootstrap-"$(basename "$d")".sh
fi
# Navigate back to the service directory
echo "Finished building $d"
done