File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
root/etc/s6-overlay/s6-rc.d Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,7 @@ if [[ ! -d "${DATADIR}/mysql" ]]; then
29
29
DELETE FROM mysql.user WHERE user <> 'mariadb.sys';
30
30
EOSQL
31
31
32
- # test for empty password variable, if it's set to 0 or less than 4 characters
33
- if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
34
- TEST_LEN="0"
35
- else
36
- TEST_LEN=${#MYSQL_ROOT_PASSWORD}
37
- fi
38
-
39
- if [[ "${TEST_LEN}" -lt "4" ]]; then
32
+ if [[ "${#MYSQL_ROOT_PASSWORD}" -lt "4" ]]; then
40
33
MYSQL_PASS="CREATE USER 'root'@'%' IDENTIFIED BY '' ;"
41
34
else
42
35
MYSQL_PASS="CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;"
@@ -97,7 +90,7 @@ EONEWSQL
97
90
echo "Database Setup Completed"
98
91
99
92
# display a message about password if not set or too short
100
- if [[ "${TEST_LEN }" -lt "4" ]]; then
93
+ if [[ "${#MYSQL_ROOT_PASSWORD }" -lt "4" ]]; then
101
94
cat <<-EOFPASS
102
95
103
96
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/with-contenv bash
2
2
# shellcheck shell=bash
3
3
4
- # display a message about upgrading database if needed
5
- if mariadb-upgrade -u root -p"${MYSQL_ROOT_PASSWORD}" --check-if-upgrade-is-needed >/dev/null 2>&1; then
6
- cat <<-EOF
4
+ if [[ "${#MYSQL_ROOT_PASSWORD}" -gt "3" ]]; then
5
+ # display a message about upgrading database if needed
6
+ if mariadb-upgrade -u root -p"${MYSQL_ROOT_PASSWORD}" --check-if-upgrade-is-needed >/dev/null 2>&1; then
7
+ cat <<-EOF
7
8
8
9
9
10
@@ -15,5 +16,6 @@ if mariadb-upgrade -u root -p"${MYSQL_ROOT_PASSWORD}" --check-if-upgrade-is-need
15
16
16
17
17
18
EOF
18
- sleep 5s
19
+ sleep 5s
20
+ fi
19
21
fi
You can’t perform that action at this time.
0 commit comments