-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnifstart
executable file
·111 lines (97 loc) · 2.41 KB
/
nifstart
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
DOCKER_RUNTIMES=$(docker -D info | grep Runtimes)
# Arg parsing
POSITIONAL=()
SIMULATOR=false
CLION=false
ROS_DISTRO="galactic"
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-s|--with-simulator)
SIMULATOR=true
shift # past argument
shift # past value
;;
-c|--clion)
CLION=true
shift # past argument
shift # past value
;;
--cuda-host)
CUDA="host"
shift # past argument
shift # past value
;;
--foxy)
ROS_DISTRO="foxy"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ -n $1 ]]; then
echo "Last line of file specified as non-opt/last argument:"
tail -1 "$1"
fi
if [[ "$DOCKER_RUNTIMES" == *"nvidia"* ]];
then
OPTIONS_NVIDIA="--env="NVIDIA_VISIBLE_DEVICES"=all \
--env="NVIDIA_DRIVER_CAPABILITIES"=all \
--runtime=nvidia"
else
OPTIONS_NVIDIA=""
fi
if [[ $CUDA == "host" ]] ;
then
if [[ $ROS_DISTRO == "galactic" ]]
then
ADERC=".aderc-cuda-galactic"
echo "Starting with .aderc-*-cuda-galactic"
else
ADERC=".aderc-cuda"
echo "Starting with .aderc-*-cuda"
fi
elif $SIMULATOR ;
then
ADERC=".aderc-lgsvl"
elif [[ $ROS_DISTRO == "galactic" ]]
then
ADERC=".aderc-galactic"
echo "Starting with .aderc-galactic"
else
ADERC=".aderc"
fi
OPTIONS_CLION=""
if $CLION ;
then
if [[ $CLION_PATH ]] ;
then
OPTIONS_CLION="-v $CLION_PATH:/opt/clion \
-v /home/$USER/.config/JetBrains:/home/$USER/.config/JetBrains \
-v /home/$USER/.local/share/JetBrains:/home/$USER/.local/share/JetBrains "
else
echo ""
echo "!!!"
echo "CLION_PATH not specified, starting without clion volume."
echo "To specify a CLION_PATH, run \`export CLION_PATH=</path/to/clion>\` (default to /opt/clion-<version>)."
echo "!!!"
echo ""
OPTIONS_CLION="-v /home/$USER/.config/JetBrains:/home/$USER/.config/JetBrains \
-v /home/$USER/.local/share/JetBrains:/home/$USER/.local/share/JetBrains "
sleep 2
fi
fi
ade --rc $ADERC \
start -f --update -- \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /etc/localtime:/etc/localtime:ro \
-v /media/$USER/:/home/$USER/media \
-v /home/$USER/dev_ws/src/bag/:/home/$USER/bag \
$OPTIONS_CLION \
$OPTIONS_NVIDIA