-
Notifications
You must be signed in to change notification settings - Fork 32
/
entrypoint
executable file
·29 lines (27 loc) · 1.25 KB
/
entrypoint
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
#!/bin/sh
if [ "z$1" = "zshell" ] ; then
exec $DSHELL -l
elif [ "z$1" = "zsetup" ] ; then
cat << EOF
G=\$(docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls kbase/kb-sdk -l /var/run/docker.sock|awk '{print \$4}');
alias kb-sdk='docker run -i --rm -v \$HOME:\$HOME -u 0 -w \$(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DUSER=\$USER -e DSHELL=\$SHELL -e KBASE_TEST_TOKEN=\$KBASE_TEST_TOKEN --group-add \$G kbase/kb-sdk'
EOF
elif [ "z$1" = "zgenscript" ] ; then
cat << EOF
#!/bin/sh
# Cache the group for the docker file
if [ ! -e \$HOME/.kbsdk.cache ] ; then
docker run -i -v /var/run/docker.sock:/var/run/docker.sock --entrypoint ls kbase/kb-sdk -l /var/run/docker.sock|awk '{print \$4}' > \$HOME/.kbsdk.cache
fi
exec docker run -i --rm -v \$HOME:\$HOME -u 0 -w \$(pwd) -v /var/run/docker.sock:/var/run/docker.sock -e DUSER=\$USER -e DSHELL=\$SHELL -e KBASE_TEST_TOKEN=\$KBASE_TEST_TOKEN --group-add \$(cat \$HOME/.kbsdk.cache) kbase/kb-sdk \$@
EOF
elif [ "z$1" = "zprune" ] ; then
echo "Used during build to shrink image. Not needed by the user."
for f in $(find /src/submodules/jars/lib/jars -type f -name '*.jar') ; do
if [ $(grep -c $f /src/bin/kb-sdk) -eq 0 ] ; then
rm $f
fi
done
else
exec kb-sdk $@
fi