Skip to content

Commit 8171f9d

Browse files
illuusiogrooverdan
authored andcommitted
MDEV-31423: Make sure that datadir is available with SySV-init script
Commit fixes Debian SySV-init script fail: /etc/init.d/mariadb: line 90: [: : integer expression expected which happens if datadir is not changed in configuration which makes it invisible when printing MariaDB config defaults. Commit makes sure that there is some value if nothing else if in hand use default /usr/lib/mysql or fail with correct error message if directory is not present
1 parent bf0a54d commit 8171f9d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

debian/mariadb-server-10.6.mariadb.init

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ sanity_checks() {
8484

8585
# check for diskspace shortage
8686
datadir=`mariadbd_get_param datadir`
87+
88+
# If datadir location is not changed int configuration
89+
# then it's not printed with /usr/sbin/mariadbd --print-defaults
90+
# then we use 'sane' default.
91+
if [ -z "$datadir"]
92+
then
93+
datadir="/var/lib/mysql"
94+
fi
95+
96+
# Check if there datadir location is available and
97+
# fail if it's not
98+
if [ ! -d "$datadir" ]
99+
then
100+
log_failure_msg "$0: ERROR: Can't locate MariaDB installation location $datadir"
101+
echo "ERROR: Can't locate MariaDB installation location $datadir" | $ERR_LOGGER
102+
exit 1
103+
fi
104+
87105
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
88106
# 4096 blocks is then lower than 4 MB
89107
df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)"

0 commit comments

Comments
 (0)