-
Notifications
You must be signed in to change notification settings - Fork 134
/
entrypoint.sh
executable file
·43 lines (31 loc) · 993 Bytes
/
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
#!/bin/bash
set -e
source $BITNAMI_PREFIX/bitnami-utils.sh
print_welcome_page
# if command starts with an option, prepend mysqld
if [ "${1:0:1}" = '-' ]; then
EXTRA_OPTIONS="$@"
set -- mysqld.bin
fi
if [ ! "$(ls -A $BITNAMI_APP_VOL_PREFIX/conf)" ]; then
generate_conf_files
fi
if [ "$1" = 'mysqld.bin' ]; then
set -- $@ $PROGRAM_OPTIONS
mkdir -p $BITNAMI_APP_DIR/tmp
chown -R $BITNAMI_APP_USER:$BITNAMI_APP_USER $BITNAMI_APP_DIR/tmp || true
if [ ! "$(ls -A $BITNAMI_APP_VOL_PREFIX/data)" ]; then
set -- "$@" --init-file=/tmp/init_mysql.sql
initialize_database
create_custom_database
create_mysql_user
print_app_credentials $BITNAMI_APP_NAME $MARIADB_USER `print_mysql_password` `print_mysql_database`
else
print_container_already_initialized $BITNAMI_APP_NAME
fi
chown -R $BITNAMI_APP_USER:$BITNAMI_APP_USER \
$BITNAMI_APP_VOL_PREFIX/conf/ \
$BITNAMI_APP_VOL_PREFIX/logs/ \
$BITNAMI_APP_VOL_PREFIX/data/ || true
fi
exec "$@"