fulgens/build.sh

33 lines
969 B
Bash
Raw Normal View History

2024-09-28 19:41:34 +01:00
#!/bin/sh
clear
fancy() {
width="$(tput cols)"
# Create a string of spaces based on the width
spaces=$(printf '%*s' "$width" '' | tr ' ' ' ')
# Print the formatted output
printf "%b%s %s %s%s\n\033[0m" "$1" "$spaces" "$2" "$(printf '%*s' "$((width - ${#2} - 4))" '' | tr ' ' ' ')" "$spaces"
}
fancy "\033[1;106m" "Welcome to fulgens! Starting build..."
sleep 1
2024-09-28 19:41:34 +01:00
path=$(realpath "$(dirname "$0")") || exit 1
searchDir="$path/services-src"
find -L "$searchDir" -type f -name "build.sh" | while read -r buildScript; do
clear
buildDir=$(dirname "$buildScript")
fancy "\033[1;104m" "Starting build of $(basename "$buildDir")..."
(cd "$buildDir" && ./build.sh) || {
printf "\033[1;31mError: %s failed.\033[0m\n" "$buildScript"
2024-09-28 19:41:34 +01:00
exit 1
}
done
clear
fancy "\033[1;105m" "Building Fulgens..."
2024-09-28 19:41:34 +01:00
go build --ldflags "-s -w" -o "$path/fulgens" || exit 1
clear
fancy "\033[1;102m" "Fulgensfas has been built successfully!"