Blame view

PYROS 759 Bytes
70921b83   ALEXIS-PC\alexis   adding PYROS scri...
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env bash

# test if user passed a command as parameter
if test $# -lt 1
then
    echo "Missing command, use one of the commands below"
    python3 pyros.py --help
    exit 1
fi

# test if docker is installed 
4bfaf011   ALEXIS-PC\alexis   improving test in...
12
if [ -x "$(command -v docker)" ];
70921b83   ALEXIS-PC\alexis   adding PYROS scri...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
then
    docker=true
else
    docker=false
fi

if $docker
then
    # test if container is running
    if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 2 ];
    then
        container=true;
    else
        container=false;
    fi
    if $container;
    then
        docker exec -it pyros python3 pyros.py $1
    else
        # starting container first and then launch pyros.py
        cd docker; docker-compose up -d
        docker exec -it pyros python3 pyros.py $1
    fi
else
    python3 pyros.py $1
fi