-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·77 lines (64 loc) · 1.86 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
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
#!/bin/sh
_aux_folder="./aux"
. ./config.sh
build() {
cd "$_aux_folder"
if sh ./build.sh; then
return 0
else
return 1
fi
}
build_wrapper() {
if build; then
echo "Build successful!"
echo "Starting container..."
else
echo "An error ocurred during the build"
echo "Try running ./build.sh again"
exit 3
fi
}
# X11
# xhost +
# # Pulseaudio
# if ! ( [ -f /tmp/pulseaudio.socket ] ); then
# cp "$_aux_folder"/files/pulseaudio.client.conf /tmp/pulseaudio.client.conf
# pactl load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket
# fi
if ! systemctl is-active --quiet docker.service; then
echo "Insert password to start docker"
sudo systemctl start --now docker.service
systemctl is-active --quiet docker.service || { echo "You need to start docker!"; exit 1; }
fi
docker_images=$(docker images -q $IMAGE_NAME)
if [ -z "$docker_images" ]; then
echo "Docker image not found"
echo "Building image..."
echo
build_wrapper
elif [ "$1" = "--rebuild" ]; then
echo "Rebuilding image"
build_wrapper
fi
echo Starting container...
docker run -ti --rm \
-v ~/.bashrc:/home/docker/.bashrc \
-v ~/.bash/:/home/docker/.bash/ \
-v ~/.inputrc/:/home/docker/.inputrc/ \
-v /etc/inputrc:/etc/inputrc \
-w /home/docker \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
$IMAGE_NAME "/bin/bash"
# Enable ptrace
# --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
# Shared folder
# -v "$(pwd)"/shared:/home/docker/shared \
# X11
# -e DISPLAY="$DISPLAY" \
# -v /tmp/.X11-unix:/tmp/.X11-unix \
# Pulseaudio
# -e PULSE_SERVER=unix:/tmp/pulseaudio.socket \
# -e PULSE_COOKIE=/tmp/pulseaudio.cookie \
# -v /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \
# -v /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \