-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·39 lines (37 loc) · 1006 Bytes
/
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
#!/bin/bash
IMAGE_NAME="kakalin/qt:5.12.0"
docker_run_params=$(cat <<-END
--rm \
-it \
-e QT_X11_NO_MITSHM=1 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $PWD:/home/user/canbus-tool \
-w /home/user/canbus-tool \
-v $PWD/can.conf:/home/user/can.conf \
--network=host \
$IMAGE_NAME
END
)
xhost +localhost
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
GPU=$(lspci | grep -i '.* vga .* nvidia .*')
if [[ $GPU == *' NVIDIA '* ]]; then
# printf 'Nvidia GPU is present: %s\n' "$GPU"
docker run \
--gpus all \
-e DISPLAY=$DISPLAY \
$docker_run_params
else
docker run \
-e DISPLAY=$DISPLAY \
$docker_run_params
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
docker run \
-e DISPLAY="host.docker.internal:0" \
-e QT_QUICK_BACKEND=software \
$docker_run_params
exec "$@"
else
echo "Haven't supported this OS Type, please check command\n and update it."
fi