-
Notifications
You must be signed in to change notification settings - Fork 2
/
tini
37 lines (34 loc) · 803 Bytes
/
tini
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
#!/usr/bin/env sh
set -eu
# If this script ever gives you a problem, just change your entrypoint to _tini
# and report the issue
# If running in singularity
if [ -d "/.singularity.d" ]; then
while [ "${#}" -gt "0" ]; do
case ${1} in
# Signifies the rest is the command, so break
--)
shift 1
break
;;
# Args that take one arg
-e|-p)
shift 2
;;
# No extra args (-e/-p are merged into one arg)
-l|--version|-v|-vv|-vvv|-s|-w|-g|-e*|-p*)
shift 1
;;
*) # No match must mean the real command
break
;;
esac
done
exec ${@+"${@}"}
else
if [ -e "/usr/local/bin/_tini" ]; then
exec /usr/local/bin/_tini ${@+"${@}"}
else
exec "$(dirname "${0}")/_tini" ${@+"${@}"}
fi
fi