-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun
More file actions
executable file
·51 lines (43 loc) · 1.29 KB
/
run
File metadata and controls
executable file
·51 lines (43 loc) · 1.29 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
#!/bin/sh
SCRIPT_PATH="$(dirname -- "${0}")"
SCRIPT_PATH="$(cd -- "$SCRIPT_PATH" && pwd)"
if [ "${INSIDE_NB_DOCKER_CONTAINER}" = "1" ]; then
echo "Probably you're already inside the Docker container. Don't try run ./run from the container."
exit 1
fi
IMAGE_NAME=artiomn/nb-build-image
ADD_PARAMS=""
if ! command -v docker >/dev/null 2>&1; then
echo "Docker binary was not found. You must to install it." >&2
if [ -f /etc/debian_version ]; then
echo "Try: sudo apt-get install docker.io" >&2
elif [ -f /etc/arch-release ]; then
echo "Try: sudo pacman -Sy docker" >&2
elif [ -f /etc/redhat-release ]; then
echo "Try: sudo yum install docker" >&2
else
echo "Use packaging system for your distributive to install Docker." >&2
fi
echo "Exiting..." >&2
exit 1
fi
if [ "$1" = "--" ]; then
shift
elif [ "$1" = "-q" ]; then
xhost +local:
IMAGE_NAME=artiomn/nb-qt-creator-image
shift
CMD="/usr/bin/qtcreator ${*}"
fi
if [ "$1" = "--" ]; then
shift
fi
if [ -z "${CMD}" ]; then
CMD=${*:-bash}
fi
docker run -it --rm --network host --cap-add sys_ptrace --privileged \
-v "${SCRIPT_PATH}:/usr/src/gb" \
-e "EXT_UID=$(id -u)" -e "EXT_GID=$(id -g)" \
-w /usr/src/gb \
${ADD_PARAMS} \
"${IMAGE_NAME}" ${CMD}