Skip to content

Commit 82b523d

Browse files
authored
Update bobarr.sh
Update bobarr.sh to check if 'docker-compose' or 'docker compose' is present on the system.
1 parent 0fdf960 commit 82b523d

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

scripts/bobarr.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,50 @@ cat << "EOF"
1616
1717
EOF
1818

19+
if docker compose > /dev/null 2>&1; then
20+
if docker compose version --short | grep "^2." > /dev/null 2>&1; then
21+
COMPOSE_VERSION='docker compose'
22+
fi
23+
elif docker-compose > /dev/null 2>&1; then
24+
if ! [[ $(alias docker-compose 2> /dev/null) ]] ; then
25+
if docker-compose version --short | grep "^2." > /dev/null 2>&1; then
26+
COMPOSE_VERSION='docker-compose'
27+
fi
28+
fi
29+
fi
30+
1931
args=$1
2032

2133
stop_bobarr() {
22-
docker-compose down --remove-orphans || true
34+
$COMPOSE_VERSION down --remove-orphans || true
2335
}
2436

2537
after_start() {
2638
echo ""
2739
echo "bobarr started correctly, printing bobarr api logs"
2840
echo "you can close this and bobarr will continue to run in backgound"
2941
echo ""
30-
docker-compose logs -f api
42+
$COMPOSE_VERSION logs -f api
3143
}
3244

3345
if [[ $args == 'start' ]]; then
3446
stop_bobarr
35-
docker-compose up --force-recreate -d
47+
$COMPOSE_VERSION up --force-recreate -d
3648
after_start
3749
elif [[ $args == 'start:vpn' ]]; then
3850
stop_bobarr
39-
docker-compose -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
51+
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
4052
after_start
4153
elif [[ $args == 'start:wireguard' ]]; then
4254
stop_bobarr
43-
docker-compose -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
55+
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
4456
after_start
4557
elif [[ $args == 'stop' ]]; then
4658
stop_bobarr
4759
echo ""
4860
echo "bobarr correctly stopped"
4961
elif [[ $args == 'update' ]]; then
50-
docker-compose pull
62+
$COMPOSE_VERSION pull
5163
echo ""
5264
echo "bobarr docker images correctly updated, you can now re-start bobarr"
5365
else

0 commit comments

Comments
 (0)