summaryrefslogtreecommitdiff
path: root/debian/mariadb-server-10.2.postrm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/mariadb-server-10.2.postrm')
-rw-r--r--debian/mariadb-server-10.2.postrm42
1 files changed, 17 insertions, 25 deletions
diff --git a/debian/mariadb-server-10.2.postrm b/debian/mariadb-server-10.2.postrm
index 7cee5150ef9..f8a95df54ea 100644
--- a/debian/mariadb-server-10.2.postrm
+++ b/debian/mariadb-server-10.2.postrm
@@ -1,9 +1,6 @@
#!/bin/bash -e
-# It is possible that Debconf has already been removed, too.
-if [ -f /usr/share/debconf/confmodule ]; then
- . /usr/share/debconf/confmodule
-fi
+. /usr/share/debconf/confmodule
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
@@ -46,41 +43,36 @@ esac
#
# - Do NOT purge logs or data if another mysql-sever* package is installed (#307473)
# - Remove the mysql user only after all his owned files are purged.
-#
+#
if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then
# we remove the mysql user only after all his owned files are purged
rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
rm -rf /var/log/mysql
- db_input high mysql-server-5.1/postrm_remove_databases || true
+ db_input high mariadb-server-10.2/postrm_remove_databases || true
db_go || true
- db_get mysql-server-5.1/postrm_remove_databases || true
+ db_get mariadb-server-10.2/postrm_remove_databases || true
if [ "$RET" = "true" ]; then
# never remove the debian.cnf when the databases are still existing
# else we ran into big trouble on the next install!
rm -f /etc/mysql/debian.cnf
- rm -rf /var/lib/mysql
- rm -rf /var/run/mysqld
+ # Remove all contents from /var/lib/mysql except if it's a
+ # directory with file system data. See #829491 for details and
+ # #608938 for potential mysql-server leftovers which erroneously
+ # had been renamed.
+ find /var/lib/mysql -mindepth 1 \
+ -not -path '*/lost+found/*' -not -name 'lost+found' \
+ -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \
+ -delete
+ # "|| true" still needed as rmdir still exits with non-zero if
+ # /var/lib/mysql is a mount point
+ rmdir --ignore-fail-on-non-empty /var/lib/mysql || true
+ rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind
userdel mysql || true
fi
- # (normally) Automatically added by dh_installinit
- if [ "$1" = "purge" ] ; then
- update-rc.d mysql remove >/dev/null || exit 0
- fi
- # (normally) End automatically added section
-fi
-
-# (normally) Automatically added by dh_installdebconf
-if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
- . /usr/share/debconf/confmodule
- db_purge
fi
-# (normally) End automatically added section
-if [ "$1" = "purge" ] ; then
- rm -f /etc/apparmor.d/force-complain/usr.sbin.mysqld >/dev/null 2>&1 || true
-fi
-# no DEBHELPER here, "update-rc.d remove" fails if mysql-server-5.1 is installed
+#DEBHELPER#
exit 0