@@ -16,38 +16,50 @@ cat << "EOF"
16
16
17
17
EOF
18
18
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
+
19
31
args=$1
20
32
21
33
stop_bobarr () {
22
- docker-compose down --remove-orphans || true
34
+ $COMPOSE_VERSION down --remove-orphans || true
23
35
}
24
36
25
37
after_start () {
26
38
echo " "
27
39
echo " bobarr started correctly, printing bobarr api logs"
28
40
echo " you can close this and bobarr will continue to run in backgound"
29
41
echo " "
30
- docker-compose logs -f api
42
+ $COMPOSE_VERSION logs -f api
31
43
}
32
44
33
45
if [[ $args == ' start' ]]; then
34
46
stop_bobarr
35
- docker-compose up --force-recreate -d
47
+ $COMPOSE_VERSION up --force-recreate -d
36
48
after_start
37
49
elif [[ $args == ' start:vpn' ]]; then
38
50
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
40
52
after_start
41
53
elif [[ $args == ' start:wireguard' ]]; then
42
54
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
44
56
after_start
45
57
elif [[ $args == ' stop' ]]; then
46
58
stop_bobarr
47
59
echo " "
48
60
echo " bobarr correctly stopped"
49
61
elif [[ $args == ' update' ]]; then
50
- docker-compose pull
62
+ $COMPOSE_VERSION pull
51
63
echo " "
52
64
echo " bobarr docker images correctly updated, you can now re-start bobarr"
53
65
else
0 commit comments