-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
61 lines (51 loc) · 1.41 KB
/
start.sh
File metadata and controls
61 lines (51 loc) · 1.41 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
#!/bin/bash
orange=`tput setaf 3`
reset_color=`tput sgr0`
get_real_path(){
if [ "${1:0:1}" == "/" ]; then
echo "$1"
else
realpath -m "$PWD"/"$1"
fi
}
ARCH=`uname -m`
if [ $ARCH == "x86_64" ]; then
if command -v nvidia-smi &> /dev/null; then
DEVICE=cuda
ARGS="--ipc host --gpus all"
else
echo "${orange}CPU-only${reset_color} build is not supported yet"
exit 1
fi
else
echo "${orange}${ARCH}${reset_color} architecture is not supported"
exit 1
fi
if [ $# != 1 ]; then
echo "Usage:
bash start.sh [DATASETS_DIR]
"
exit 1
fi
DATASETS_DIR=$(get_real_path "$1")
if [ ! -d $DATASETS_DIR ]; then
echo "Error: DATASETS_DIR=$DATASETS_DIR is not an existing directory."
exit 1
fi
PROJECT_ROOT_DIR=$(cd ./"`dirname $0`"/.. || exit; pwd)
echo "Running on ${orange}${ARCH}${reset_color} with ${orange}${DEVICE}${reset_color}"
xhost +
docker run -it -d --rm \
$ARGS \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--privileged \
--name ${USER}_opr_ros2 \
--net host \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v $PROJECT_ROOT_DIR:/home/docker_opr_ros2/ros2_ws:rw \
-v $DATASETS_DIR:/home/docker_opr_ros2/Datasets:rw \
open-place-recognition-ros2:devel
xhost -
docker exec --user root \
${USER}_opr_ros2 bash -c "/etc/init.d/ssh start"