Skip to content

Commit

Permalink
Merge pull request #276 from Oratorian/patch-1
Browse files Browse the repository at this point in the history
Update bobarr.sh to check if 'docker-compose' or 'docker compose' is present on the system.
  • Loading branch information
iam4x authored Nov 1, 2023
2 parents 0fdf960 + 82b523d commit 8c5cd0d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions scripts/bobarr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,50 @@ cat << "EOF"
EOF

if docker compose > /dev/null 2>&1; then
if docker compose version --short | grep "^2." > /dev/null 2>&1; then
COMPOSE_VERSION='docker compose'
fi
elif docker-compose > /dev/null 2>&1; then
if ! [[ $(alias docker-compose 2> /dev/null) ]] ; then
if docker-compose version --short | grep "^2." > /dev/null 2>&1; then
COMPOSE_VERSION='docker-compose'
fi
fi
fi

args=$1

stop_bobarr() {
docker-compose down --remove-orphans || true
$COMPOSE_VERSION down --remove-orphans || true
}

after_start() {
echo ""
echo "bobarr started correctly, printing bobarr api logs"
echo "you can close this and bobarr will continue to run in backgound"
echo ""
docker-compose logs -f api
$COMPOSE_VERSION logs -f api
}

if [[ $args == 'start' ]]; then
stop_bobarr
docker-compose up --force-recreate -d
$COMPOSE_VERSION up --force-recreate -d
after_start
elif [[ $args == 'start:vpn' ]]; then
stop_bobarr
docker-compose -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
after_start
elif [[ $args == 'start:wireguard' ]]; then
stop_bobarr
docker-compose -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
after_start
elif [[ $args == 'stop' ]]; then
stop_bobarr
echo ""
echo "bobarr correctly stopped"
elif [[ $args == 'update' ]]; then
docker-compose pull
$COMPOSE_VERSION pull
echo ""
echo "bobarr docker images correctly updated, you can now re-start bobarr"
else
Expand Down

0 comments on commit 8c5cd0d

Please sign in to comment.