mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
MDEV-33750: Make sure that datadir always has some value and exists
Adapted from upstream commit8171f9da87
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 in30fb72ca6e
as the preinst script will always create the data directory if missing, and thus checking for it right after the creation is moot.
This commit is contained in:
parent
2adaf5c261
commit
3f44efaa17
1 changed files with 6 additions and 7 deletions
13
debian/mariadb-server.mariadb.init
vendored
13
debian/mariadb-server.mariadb.init
vendored
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue