-
Notifications
You must be signed in to change notification settings - Fork 0
/
godocker
executable file
·49 lines (38 loc) · 1.05 KB
/
godocker
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
#!/bin/sh
DISTRO="ubuntu-20.04"
if [ -z ${BASEDIR} ]; then
echo >&2 "NOTE: Variable BASEDIR undefined, using ~/mnt/projet."
BASEDIR=~/mnt/projet
fi
if [ -z "${1}" ]; then
echo >&2 "ERROR: No projet name given."
exit 1
fi
if [ -z "${2}" ]; then
echo >&2 "NOTE: No distro given, using ubuntu-20.04"
else
DISTRO=${2}
fi
P=$(realpath ${BASEDIR}/${1})
if ! [ -d "${P}" ]; then
echo >&2 "ERROR: ${P} projet not found"
exit 1
fi
B=$(realpath ${BASEDIR})
echo "Using ${B} as base path"
echo "Using ${P} as project path"
# --cap-add=SYS_PTRACE \
# --mount type=bind,src=$SSH_AUTH_SOCK,dst=/ssh-auth.sock \
# -e SSH_AUTH_SOCK=/ssh-auth.sock \
CMD="docker run -it --rm=true \
--name yocto-${1} \
-v "$SSH_AUTH_SOCK:$SSH_AUTH_SOCK" -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
-v ${P}:/workdir \
-v ${B}/yocto-downloads:/downloads \
-v ${B}/yocto-sstate-cache:/sstate-cache \
-v ${HOME}/.ssh/config:/etc/ssh/ssh_config.d/config \
-v ${HOME}/.ssh/known_hosts:/etc/ssh/ssh_known_hosts \
crops/poky:${DISTRO} \
--workdir=/workdir"
echo ${CMD}
exec ${CMD}