-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·38 lines (31 loc) · 1.01 KB
/
setup.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
#!/bin/sh
set -e
SETUP_DIR="/setup.d/"
if [ -z "${ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
# shellcheck disable=SC2034
if /usr/bin/find "$SETUP_DIR" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: $SETUP_DIR is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in $SETUP_DIR"
find "$SETUP_DIR" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo >&3 "$0: Launching $f";
"$f"
else
# warn on shell scripts without exec bit
echo >&3 "$0: Ignoring $f, not executable";
fi
;;
*) echo >&3 "$0: Ignoring $f";;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in $SETUP_DIR, skipping configuration"
fi
exit 0