-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathclair-entrypoint.sh
executable file
·54 lines (43 loc) · 1.1 KB
/
clair-entrypoint.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
#!/bin/sh
CLAIRENTRY=${CLAIRENTRY:=$1}
CLAIRENTRY=${CLAIRENTRY:=scanner}
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
display_usage() {
echo "Usage: ${0} <scanner|shell|help>"
echo
echo "If the first argument isn't one of the above modes,"
echo "the arguments will be exec'd directly, i.e.:"
echo
echo " ${0} uptime"
}
if [[ "${CLAIRENTRY}" = "help" ]]
then
display_usage
exit 0
fi
cat << "EOF"
______ _ __ _ _____
/ ____| | | / \ | | | \
| | | | / /\ \ | | | /\ /
| |____ | |__ / ____ \ | | | __ \
\______| |____| /_/ \_\ |_| |_| \_\
EOF
case "$CLAIRENTRY" in
"shell")
echo "Entering shell mode"
exec /bin/sh
;;
"scanner")
echo "Running scanner"
/bin/sh ${CLAIRDIR}/generate_mitm_ca.sh
exec supervisord -c ${CLAIRDIR}/supervisord.conf 2>&1
;;
*)
echo "Running '$CLAIRENTRY'"
exec $CLAIRENTRY
;;
esac