diff options
author | 2021-12-16 19:43:11 +0000 | |
---|---|---|
committer | 2021-12-16 19:43:11 +0000 | |
commit | 16337dc397afe0668e609d7edbcc5dc74d79b849 (patch) | |
tree | 91bba0cdefea4913be7918e434a8390653aa7916 /kubernetes/common/mariadb-init/resources/config/db_init.sh | |
parent | 7ed8b00a6a0ff82a1e86702fe041f286a7fd089d (diff) | |
parent | fb9dc874a2e6419cab4ed231743b3d405c753cb6 (diff) |
Merge "[COMMON] Fix some array bashisms"
Diffstat (limited to 'kubernetes/common/mariadb-init/resources/config/db_init.sh')
-rwxr-xr-x | kubernetes/common/mariadb-init/resources/config/db_init.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kubernetes/common/mariadb-init/resources/config/db_init.sh b/kubernetes/common/mariadb-init/resources/config/db_init.sh index df7c336405..8f7e7ce44b 100755 --- a/kubernetes/common/mariadb-init/resources/config/db_init.sh +++ b/kubernetes/common/mariadb-init/resources/config/db_init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh {{/* # Copyright © 2019 Orange @@ -32,13 +32,13 @@ while read DB ; do */}} eval USER=\$$USER_VAR PASS=$(eval echo -n \$$PASS_VAR | sed -e "s/'/''/g") - MYSQL_OPTS=( -h ${DB_HOST} -P ${DB_PORT} -uroot -p${MYSQL_ROOT_PASSWORD} ) + MYSQL_OPTS=" -h "${DB_HOST}" -P "${DB_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD} echo "Creating database ${DB} and user ${USER}..." - mysql "${MYSQL_OPTS[@]}" -e "CREATE OR REPLACE USER '${USER}'@'%' IDENTIFIED BY '${PASS}'" - mysql "${MYSQL_OPTS[@]}" -e "CREATE DATABASE IF NOT EXISTS ${DB}" - mysql "${MYSQL_OPTS[@]}" -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'%'" + mysql $MYSQL_OPTS -e "CREATE OR REPLACE USER '${USER}'@'%' IDENTIFIED BY '${PASS}'" + mysql $MYSQL_OPTS -e "CREATE DATABASE IF NOT EXISTS ${DB}" + mysql $MYSQL_OPTS -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'%'" echo "Created database ${DB} and user ${USER}." done <<EOF |