Skip to content

Commit 8b09976

Browse files
committed
chore(base): add source support
1 parent 207fc85 commit 8b09976

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

debootstrap/bullseye/rootfs/usr/bin/init-stack

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
# check to see if this file is being run or sourced from another script
4+
_is_sourced() {
5+
# https://unix.stackexchange.com/a/215279
6+
[ "${#FUNCNAME[@]}" -ge 2 ] \
7+
&& [ "${FUNCNAME[0]}" = '_is_sourced' ] \
8+
&& [ "${FUNCNAME[1]}" = 'source' ]
9+
}
10+
311
env_list=$(find /opt/drycc/*/env/* 2>/dev/null || echo "")
412
for env in ${env_list}
513
do
@@ -31,8 +39,10 @@ do
3139
"${_exec}"
3240
done
3341

34-
if [[ "$$" == "1" ]] ; then
35-
exec tini -g -- "$@"
36-
else
37-
exec tini -sg -- "$@"
42+
if ! _is_sourced; then
43+
if [[ "$$" == "1" ]] ; then
44+
exec tini -g -- "$@"
45+
else
46+
exec tini -sg -- "$@"
47+
fi
3848
fi

0 commit comments

Comments
 (0)