-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·53 lines (46 loc) · 1.3 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
#!/bin/bash
# Ensure files and directories exist before docker attempts to mount them
touch ${HOME}/.nvidia-settings-rc
touch ${HOME}/.Xauthority
mkdir -p ${HOME}/.nvsdkm
mkdir -p ${HOME}/nvidia
mkdir -p ${HOME}/Downloads
# Fix incorrect permission on VisionWorks index.html which breaks installation on host
find ${HOME}/nvidia \
-path "*rootfs*" -prune -false \
-o \
-path "*VisionWorks*" \
-name index.html \
-perm 444 \
-exec chmod 664 {} \;
user_image=$(docker images -q sdkmanager:${USER})
if [ -n "${user_image}" ]; then
IMAGE="sdkmanager:${USER}"
else
IMAGE="sdkmanager:latest"
fi
docker run \
-it \
--privileged \
--shm-size=1024M \
--net=host \
--security-opt seccomp=chrome.json \
-e DISPLAY \
-v /dev/bus/usb:/dev/bus/usb \
-v ${HOME}/.Xauthority:${HOME}/.Xauthority:ro \
-v ${HOME}/Downloads:${HOME}/Downloads \
-v ${HOME}/nvidia:${HOME}/nvidia \
-v ${HOME}/.nvidia-settings-rc:${HOME}/.nvidia-settings-rc \
-v ${HOME}/.nvsdkm:${HOME}/.nvsdkm \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v /etc/localtime:/etc/localtime:ro \
--name="sdkmanager" \
${IMAGE}
read -n 1 -p "Save container updates? [y/N] " ANSWER
case $ANSWER in
Y|y) docker commit sdkmanager sdkmanager:${USER}
docker rm sdkmanager
;;
*) docker rm sdkmanager
;;
esac