-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·57 lines (49 loc) · 1.17 KB
/
run.sh
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
ARGS=("$@") # Save all arguments in an array
AREA=${ARGS[0]} # Get the first argument
# Check if the parameter is passed, if not, set a default value (e.g., "vision")
if [ -z "$AREA" ]; then
echo "No service name provided or invalid. Valid args are: vision, hri, etc"
exit 1
fi
echo "Service name is: $AREA"
# check arguments passed as --help or -h
if [ "$AREA" == "--help" ] || [ "$AREA" == "-h" ]; then
echo "Usage: ./run.sh [service_name]"
echo "Example: ./run.sh vision"
exit 0
fi
area=""
rebuild=0
case $AREA in
vision)
echo "Running vision..."
area="vision"
;;
manipulation)
echo "Running manipulation"
area="manipulation"
;;
*)
echo "Invalid service name provided. Valid args are: vision, hri, etc"
exit 1
;;
esac
REBUILD=0
# check if one of the arguments is --rebuild
for arg in "${ARGS[@]}"; do
if [ "$arg" == "--rebuild" ]; then
rebuild=1
fi
done
if [ -z "$area" ]; then
echo "Invalid service name provided. Valid args are: vision, hri, etc"
exit 1
fi
cd docker/$area
if [ $rebuild -eq 1 ]; then
echo "Rebuilding image from area: $area"
./run.sh --rebuild
else
echo "Running image from area: $area"
./run.sh
fi