forked from yuxiang-gao/docker-ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·77 lines (69 loc) · 1.33 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·77 lines (69 loc) · 1.33 KB
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
71
72
73
74
75
76
77
#!/bin/bash
set -a
DOCKER_ROS_DISTRO="kinetic"
DOCKER_ARCH="$(dpkg --print-architecture)"
function usage {
echo "Usage:"
echo "Give the images to build. If no image is given, all folders in /dockers will be built."
echo "Arguments:"
echo " -h|--help: Usage"
echo " -s|--start: Run dockers"
echo " -b|--build: Start with build"
echo " -a|--attached: Run in attached mode to see output"
echo " -e|--end: Stop dockers"
exit 1
}
function end {
docker-compose down
exit 1
}
ATTACHED="0"
PARAMS=""
while (( "$#" )); do
case "$1" in
-h|--help)
usage
;;
-s|--start)
CMD="docker-compose up"
shift
;;
-b|--build)
CMD="$CMD --build"
shift
;;
-a|--attached)
ATTACHED="1"
shift
;;
-e|--end)
end
break
;;
--) # end argument parsing
shift
break
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
usage
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
# set positional arguments in their proper place
eval set -- "$PARAMS"
function main {
if [[ ! -z $CMD ]]; then
echo "Starting docker-compile"
if [[ $1 = "0" ]]; then
CMD="$CMD -d"
fi
fi
eval "$CMD"
}
main $ATTACHED