59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
export PATH=/usr/sbin:$PATH
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
set -euo pipefail
|
|
readonly COLOUR_RESET='\e[0m'
|
|
readonly aCOLOUR=(
|
|
'\e[38;5;154m' # green | Lines, bullets and separators
|
|
'\e[1m' # Bold white | Main descriptions
|
|
'\e[90m' # Grey | Credits
|
|
'\e[91m' # Red | Update notifications Alert
|
|
'\e[33m' # Yellow | Emphasis
|
|
)
|
|
trap 'onCtrlC' INT
|
|
onCtrlC() {
|
|
echo -e "${COLOUR_RESET}"
|
|
exit 1
|
|
}
|
|
|
|
Show() {
|
|
# OK
|
|
if (($1 == 0)); then
|
|
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} OK $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
# FAILED
|
|
elif (($1 == 1)); then
|
|
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[3]}FAILED$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
exit 1
|
|
# INFO
|
|
elif (($1 == 2)); then
|
|
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} INFO $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
# NOTICE
|
|
elif (($1 == 3)); then
|
|
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[4]}NOTICE$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"
|
|
fi
|
|
}
|
|
|
|
Warn() {
|
|
echo -e "${aCOLOUR[3]}$1$COLOUR_RESET"
|
|
}
|
|
|
|
GreyStart() {
|
|
echo -e "${aCOLOUR[2]}\c"
|
|
}
|
|
|
|
ColorReset() {
|
|
echo -e "$COLOUR_RESET\c"
|
|
}
|
|
|
|
|
|
stop_test_db() {
|
|
cd "$(pwd)/testing_env"
|
|
Show 2 "Stopping containers..."
|
|
docker-compose down
|
|
rm -f "$(find . -type f \( -name "*.yml" -o -name "*.template" \) -not -name "docker-compose.yml" -not -name "env.template" )"
|
|
Show 0 "Test Server is offline"
|
|
}
|
|
|
|
stop_test_db |