Commit 70921b834f6bfd8bbc5b4e7e7ab4d5792866448f
1 parent
74a196a1
Exists in
dev
adding PYROS script wrapper
Showing
1 changed file
with
39 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,39 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +# test if user passed a command as parameter | |
4 | +if test $# -lt 1 | |
5 | +then | |
6 | + echo "Missing command, use one of the commands below" | |
7 | + python3 pyros.py --help | |
8 | + exit 1 | |
9 | +fi | |
10 | + | |
11 | +# test if docker is installed | |
12 | +if [ $(docker -v | echo $?) -eq 0 ]; | |
13 | +then | |
14 | + docker=true | |
15 | +else | |
16 | + docker=false | |
17 | +fi | |
18 | + | |
19 | +if $docker | |
20 | +then | |
21 | + # test if container is running | |
22 | + if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 2 ]; | |
23 | + then | |
24 | + container=true; | |
25 | + else | |
26 | + container=false; | |
27 | + fi | |
28 | + if $container; | |
29 | + then | |
30 | + docker exec -it pyros python3 pyros.py $1 | |
31 | + else | |
32 | + # starting container first and then launch pyros.py | |
33 | + cd docker; docker-compose up -d | |
34 | + docker exec -it pyros python3 pyros.py $1 | |
35 | + fi | |
36 | +else | |
37 | + python3 pyros.py $1 | |
38 | +fi | |
39 | + | ... | ... |