diff options
Diffstat (limited to 'debian/mariadb-server-10.6.preinst')
-rw-r--r-- | debian/mariadb-server-10.6.preinst | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/debian/mariadb-server-10.6.preinst b/debian/mariadb-server-10.6.preinst index e8f9953da7c..9a31b5c636e 100644 --- a/debian/mariadb-server-10.6.preinst +++ b/debian/mariadb-server-10.6.preinst @@ -14,11 +14,16 @@ MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" # Just kill the invalid insserv.conf.d directory without fallback -if [ -d "/etc/insserv.conf.d/mariadb/" ]; then +if [ -d "/etc/insserv.conf.d/mariadb/" ] +then rm -rf "/etc/insserv.conf.d/mariadb/" fi -if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +if [ -n "$DEBIAN_SCRIPT_DEBUG" ] +then + set -v -x + DEBIAN_SCRIPT_TRACE=1 +fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin @@ -32,7 +37,10 @@ stop_server() { # Return immediately if there are no mysqld processes running on a host # (leave containerized processes with the same name in other namespaces) # as there is no point in trying to shutdown in that case. - if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi + if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null + then + return + fi set +e invoke-rc.d mariadb stop @@ -41,7 +49,8 @@ stop_server() { set -e # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 ] && [ "$errno" != 100 ]; then + if [ "$errno" != 0 ] && [ "$errno" != 100 ] + then echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 echo "Stop it yourself and try again!" 1>&2 @@ -156,7 +165,8 @@ stop_server # If we use NIS then errors should be tolerated. It's up to the # user to ensure that the mysql user is correctly setup. # Beware that there are two ypwhich one of them needs the 2>/dev/null! -if test -n "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1; then +if test -n "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1 +then set +e fi @@ -171,13 +181,15 @@ fi # # creating mysql group if he isn't already there -if ! getent group mysql >/dev/null; then +if ! getent group mysql >/dev/null +then # Adding system group: mysql. addgroup --system mysql >/dev/null fi # creating mysql user if he isn't already there -if ! getent passwd mysql >/dev/null; then +if ! getent passwd mysql >/dev/null +then # Adding system user: mysql. adduser \ --system \ @@ -195,7 +207,8 @@ set -e # if there's a symlink, let's store where it's pointing, because otherwise # it's going to be lost in some situations -for dir in DATADIR LOGDIR; do +for dir in DATADIR LOGDIR +do checkdir=$(eval echo "$"$dir) if [ -L "$checkdir" ]; then # Use mkdir option 'Z' to create with correct SELinux context. @@ -205,7 +218,8 @@ for dir in DATADIR LOGDIR; do done # creating mysql home directory -if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]; then +if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ] +then # Use mkdir option 'Z' to create with correct SELinux context. mkdir -Z $mysql_datadir fi @@ -213,7 +227,8 @@ fi # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 # 4096 blocks is then lower than 4 MB df_available_blocks=`LC_ALL=C BLOCKSIZE= df --output=avail "$datadir" | tail -n 1` -if [ "$df_available_blocks" -lt "4096" ]; then +if [ "$df_available_blocks" -lt "4096" ] +then echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2 db_stop exit 1 @@ -232,7 +247,6 @@ find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \ | xargs -0 --no-run-if-empty chgrp mysql set -e - db_stop #DEBHELPER# |