Support docker compose as well as docker-compose

This commit is contained in:
Martin Lablans 2022-10-28 10:06:43 +02:00
parent c7f727afff
commit 5755baaf00
2 changed files with 9 additions and 3 deletions

View File

@ -63,10 +63,10 @@ case "$ACTION" in
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
checkRequirements
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
exec docker-compose -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
;;
stop)
exec docker-compose -f ./$PROJECT/docker-compose.yml $OVERRIDE down
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE down
;;
update)
exec ./lib/update-bridgehead.sh $PROJECT

View File

@ -10,9 +10,15 @@ fi
checkOwner . 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
log INFO "Checking if all prerequisites are met ..."
prerequisites="git docker docker-compose"
prerequisites="git docker $COMPOSE"
for prerequisite in $prerequisites; do
$prerequisite --version 2>&1
is_available=$?