-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeshdoxer.sh
executable file
·56 lines (50 loc) · 1.06 KB
/
meshdoxer.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
#!/bin/bash
function install() {
echo -e "Docker is not installed...\nWould you like to install? (Y/n)"
read DOCKER_INSTALL
case ${DOCKER_INSTALL} in
[nN])
echo "Aborting installation"
exit 0;
;;
esac
echo "Installing docker..."
sudo apt-get install -y docker.io
}
function init_container(){
USER_ID=$(id -u)
GROUP_ID=$(id -g)
echo "Creating Dockerfile with current users uid and guid"
cat DockerfileTemplate | sed s/XXUIDXX/$USER_ID/g > Dockerfile
sed -i s/XXGIDXX/$GROUP_ID/g Dockerfile
echo "Creating meshdoxer container"
sudo docker build -t meshdoxer .
}
function run() {
type docker >/dev/null 2>&1 || {
install
}
if [ ! -f ./Dockerfile ]; then
init_container
fi
sudo docker run -ti --rm --name meshdoxer \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd)/exchange:/home/meshmixer/exchange \
meshdoxer
}
function print_help() {
echo "usage $0 or $0 install"
}
if [ "$#" -ge 1 ]; then
case $1 in
"install")
install
;;
*)
print_help
;;
esac
else
run
fi