mirror of https://github.com/samply/bridgehead.git
Move to functions.sh
This commit is contained in:
parent
5755baaf00
commit
2aef5f29c3
|
@ -58,6 +58,8 @@ if [ -f "$PROJECT/docker-compose.override.yml" ]; then
|
||||||
OVERRIDE+=" -f ./$PROJECT/docker-compose.override.yml"
|
OVERRIDE+=" -f ./$PROJECT/docker-compose.override.yml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
detectCompose
|
||||||
|
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
start)
|
start)
|
||||||
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
|
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
|
||||||
|
|
|
@ -2,6 +2,15 @@
|
||||||
|
|
||||||
source lib/log.sh
|
source lib/log.sh
|
||||||
|
|
||||||
|
detectCompose() {
|
||||||
|
if [[ "$(docker compose version 2>/dev/null)" == *"Docker Compose version"* ]]; then
|
||||||
|
COMPOSE="docker compose"
|
||||||
|
else
|
||||||
|
COMPOSE="docker-compose"
|
||||||
|
# This is intended to fail on startup in the next prereq check.
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
exitIfNotRoot() {
|
exitIfNotRoot() {
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
log "ERROR" "Please run as root"
|
log "ERROR" "Please run as root"
|
||||||
|
|
|
@ -10,12 +10,6 @@ fi
|
||||||
checkOwner . bridgehead || exit 1
|
checkOwner . bridgehead || exit 1
|
||||||
checkOwner /etc/bridgehead bridgehead || exit 1
|
checkOwner /etc/bridgehead bridgehead || exit 1
|
||||||
|
|
||||||
if [[ "$(docker compose version 2>/dev/null)" == *"Docker Compose version"* ]]; then
|
|
||||||
COMPOSE="docker compose"
|
|
||||||
else
|
|
||||||
COMPOSE="docker-compose"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Check if user is a su
|
## Check if user is a su
|
||||||
log INFO "Checking if all prerequisites are met ..."
|
log INFO "Checking if all prerequisites are met ..."
|
||||||
prerequisites="git docker $COMPOSE"
|
prerequisites="git docker $COMPOSE"
|
||||||
|
|
Loading…
Reference in New Issue