forked from ABC-iRobotics/PlatypOUs-Mobile-Robot-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatypous_robot
executable file
·71 lines (60 loc) · 2.06 KB
/
platypous_robot
1
2
3
4
5
6
7
8
9
10
11
12
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
if [ "$#" = 1 ] && [ "$1" = "build" ]; then
docker build -f docker/Dockerfile -t platypous:latest .
elif [ "$#" = 1 ] && [ "$1" = "start_once" ]; then
if docker ps -a | grep -q "platypous_container"; then
docker rm -f platypous_container
fi
docker run \
-it \
--rm \
--privileged \
-v /dev:/dev \
--network host \
--name platypous_container \
platypous:latest
elif [ "$#" = 1 ] && [ "$1" = "start" ]; then
if docker ps -a | grep -q "platypous_container"; then
docker rm -f platypous_container
fi
docker run \
-d \
--restart always \
--privileged \
-v /dev:/dev \
--network host \
--name platypous_container \
platypous:latest
echo ""
echo " PlatypOUs container started."
echo ""
elif [ "$#" = 1 ] && [ "$1" = "stop" ]; then
if docker ps -a | grep -q "platypous_container"; then
docker rm -f platypous_container
echo ""
echo " PlatypOUs container stopped and removed."
echo ""
else
echo ""
echo " PlatypOUs container is not running."
echo ""
fi
else
echo ""
echo " Wrong/no argument. Usage: ./platypous_robot [option]"
echo ""
echo " Please choose one of the following options:"
echo ""
echo " build: builds the docker image from the repository"
echo " start_once: starts the container in the current terminal"
echo " (can be stopped by CTRL+C)"
echo " start: starts the container in the background, and "
echo " it will automatically restart after that,"
echo " even after computer restarts"
echo " stop: stops and removes the container"
echo " (after that, it won't restart"
echo " until the next 'start')"
echo ""
echo " for example: ./platypous_robot start"
echo ""
fi