2021-12-21 13:48:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
## Check if user is a su
|
|
|
|
echo "Welcome to the starting a bridgehead. We will get your instance up and running in no time"
|
|
|
|
echo "First we will check if all prerequisites are met ..."
|
2022-04-08 08:43:42 +02:00
|
|
|
prerequisites="git docker docker-compose"
|
2021-12-21 13:48:28 +01:00
|
|
|
for prerequisite in $prerequisites; do
|
|
|
|
$prerequisite --version 2>&1
|
|
|
|
is_available=$?
|
|
|
|
if [ $is_available -gt 0 ]; then
|
|
|
|
log "ERROR" "Prerequisite not fulfilled - $prerequisite is not available!"
|
|
|
|
exit 79
|
|
|
|
fi
|
|
|
|
# TODO: Check for specific version
|
|
|
|
done
|
|
|
|
|
2022-05-04 13:50:33 +02:00
|
|
|
echo "Checking /etc/bridgehead/"
|
2022-05-03 09:16:19 +02:00
|
|
|
|
|
|
|
## Download submodule
|
2022-05-04 13:50:33 +02:00
|
|
|
if [ ! -d "/etc/bridgehead/" ]; then
|
|
|
|
echo "Please set up the config folder. Instruction are in the readme."
|
2022-05-03 09:16:19 +02:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Done"
|
|
|
|
fi
|
|
|
|
|
2022-05-04 13:50:33 +02:00
|
|
|
echo "Checking /etc/bridgehead/site.conf"
|
2021-12-21 13:48:28 +01:00
|
|
|
|
|
|
|
#check if site.conf is created
|
2022-05-04 13:50:33 +02:00
|
|
|
if [ ! -f /etc/bridgehead/site.conf ]; then
|
2021-12-21 13:48:28 +01:00
|
|
|
echo "Please create your specific site.conf file from the site.dev.conf"
|
2022-05-03 09:16:19 +02:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Done"
|
2021-12-21 13:48:28 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#Load site specific variables
|
2022-05-04 13:50:33 +02:00
|
|
|
source /etc/bridgehead/site.conf
|
2021-12-21 13:48:28 +01:00
|
|
|
|
|
|
|
if [ -z "$site_name" ]; then
|
|
|
|
echo "Please set site_name"
|
2022-05-03 09:16:19 +02:00
|
|
|
exit 1
|
2021-12-21 13:48:28 +01:00
|
|
|
fi
|
|
|
|
|
2022-05-04 13:50:33 +02:00
|
|
|
echo "Checking project config"
|
2021-12-21 13:48:28 +01:00
|
|
|
|
|
|
|
#check if project env is present
|
2022-05-04 13:50:33 +02:00
|
|
|
if [ -d "/etc/bridgehead/${project}.env" ]; then
|
2022-05-03 09:16:19 +02:00
|
|
|
echo "Please copy the tempalte from ${project} and put it in the /etc/bridgehead-config/ folder"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Done"
|
2021-12-21 13:48:28 +01:00
|
|
|
fi
|
|
|
|
|
2022-01-10 15:41:38 +01:00
|
|
|
echo "All prerequisites are met!"
|