-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·48 lines (41 loc) · 1.02 KB
/
docker-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
#!/bin/sh
. /opt/sap/SYBASE.sh
set -eum
ISQL="isql -Usa -P${SA_PASSWORD}"
run_init_files () {
local f
for f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo "running $f"
"$f"
else
echo "sourcing $f"
. "$f"
fi
;;
*.sql) echo "running $f"; ${ISQL} -i $f ;;
*.sql.gz) echo "running $f"; gunzip -c "$f" | ${ISQL} ;;
*) echo "ignoring $f" ;;
esac
done
}
echo "starting docker-sybase..."
${SYBASE}/${SYBASE_ASE}/install/RUN_SYBASE &
while ! netstat -ltn | grep 5000; do
sleep 0.1
done
echo "docker-sybase started"
if [[ ! -f "/.initialized" ]]; then
DATABASE=${DATABASE-}
echo -e sp_password 'Sybase123',\'${SA_PASSWORD}\' ,sa\\ngo | isql -Usa -PSybase123
if [[ ! -z "${DATABASE}" ]]; then
echo -e "CREATE DATABASE ${DATABASE}\ngo" | ${ISQL} # Database '${DATABASE}' is now online.
else
echo "skipping database creation"
fi
run_init_files /docker-entrypoint-initdb.d/*
echo "ok" > /.initialized
fi
fg