Commit 3f44efaa authored by Otto Kekäläinen's avatar Otto Kekäläinen Committed by Daniel Black

MDEV-33750: Make sure that datadir always has some value and exists

Adapted from upstream commit 8171f9da but separated only the datadir
section from the commit and wrote it in a way that does not trigger
Shellcheck or English grammar nags.

This check is intentionally not added to the preinst script as was done
upstream in 30fb72ca as the preinst script will always create the
data directory if missing, and thus checking for it right after the
creation is moot.
parent 2adaf5c2
......@@ -91,20 +91,19 @@ sanity_checks() {
# check for diskspace shortage
datadir="$(mariadbd_get_param datadir)"
# If datadir location is not changed int configuration
# If datadir location is not customized in configuration
# then it's not printed with /usr/sbin/mariadbd --print-defaults
# then we use 'sane' default.
# and this should fall back to a sane default value
if [ -z "$datadir" ]
then
datadir="/var/lib/mysql"
fi
# Check if there datadir location is available and
# fail if it's not
if [ ! -d "$datadir" ]
# Verify the datadir location exists
if [ ! -d "$datadir" ] && [ ! -L "$datadir" ]
then
log_failure_msg "$0: ERROR: Can't locate MariaDB installation location $datadir"
echo "ERROR: Can't locate MariaDB installation location $datadir" | $ERR_LOGGER
log_failure_msg "$0: ERROR: Can't locate MariaDB data location at $datadir"
echo "ERROR: Can't locate MariaDB data location at $datadir" | $ERR_LOGGER
exit 1
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment