summaryrefslogtreecommitdiffstats
path: root/debian/mariadb-server.postrm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/mariadb-server.postrm')
-rw-r--r--debian/mariadb-server.postrm58
1 files changed, 1 insertions, 57 deletions
diff --git a/debian/mariadb-server.postrm b/debian/mariadb-server.postrm
index 9a5a9bf6..64e194f2 100644
--- a/debian/mariadb-server.postrm
+++ b/debian/mariadb-server.postrm
@@ -12,60 +12,7 @@ fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
-MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-
-MARIADBD_USERS="root"
-
-# Check if user 'mysql' exists before referring to it in pgrep
-# to avoid pgrep erroring on 'invalid user name'
-if id mysql > /dev/null 2>&1
-then
- MARIADBD_USERS="$MARIADBD_USERS,mysql"
-fi
-
-# Try to stop the server in a sane way. If it does not success let the admin
-# do it himself. No database directories should be removed while the server
-# is running! Another mariadbd in e.g. a different chroot is fine for us.
-stop_server() {
- # Return immediately if there are no mysqld processes running
- # as there is no point in trying to shutdown in that case.
- if ! pgrep -x -u "$MARIADBD_USERS" --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
- then
- return
- fi
-
- set +e
- invoke-rc.d mariadb stop
- invoke-rc.d mysql stop # Backwards compatibility
- errno=$?
- set -e
-
- # systemctl could emit exit code 100=no init script (fresh install)
- 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 "Check if there is any server running with 'pgrep \"mysqld|mariadbd\"' and" 1>&2
- echo "try to stop it yourself by issuing 'invoke-rc.d mariadb stop'." 1>&2
- db_stop
- exit 1
- fi
-}
-
-
-case "$1" in
- purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
- if [ -n "$($MYADMIN ping 2>/dev/null)" ]
- then
- stop_server
- sleep 2
- fi
- ;;
- *)
- echo "postrm called with unknown argument '$1'" 1>&2
- exit 1
- ;;
-esac
+#DEBHELPER#
#
# - Purge logs and data only if they are ours (#307473)
@@ -108,6 +55,3 @@ then
fi
fi
-
-#DEBHELPER#
-