3
# It is possible that Debconf has already been removed, too.
4
if [ -f /usr/share/debconf/confmodule ]; then
5
. /usr/share/debconf/confmodule
8
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
9
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
11
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
13
# Try to stop the server in a sane way. If it does not success let the admin
14
# do it himself. No database directories should be removed while the server
18
if [ -x /usr/sbin/invoke-rc.d ]; then
19
invoke-rc.d mysql stop
21
/etc/init.d/mysql stop
26
if [ "$?" != 0 ]; then
27
echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
28
echo "Stop it yourself and try again!" 1>&2
34
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
35
if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
41
echo "postrm called with unknown argument '$1'" 1>&2
47
# - Do NOT purge logs or data if another mysql-sever* package is installed (#307473)
48
# - Remove the mysql user only after all his owned files are purged.
50
if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then
51
# we remove the mysql user only after all his owned files are purged
52
rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
55
db_input high mysql-server-5.1/postrm_remove_databases || true
57
db_get mysql-server-5.1/postrm_remove_databases || true
58
if [ "$RET" = "true" ]; then
59
# never remove the debian.cnf when the databases are still existing
60
# else we ran into big trouble on the next install!
61
rm -f /etc/mysql/debian.cnf
63
rm -rf /var/run/mysqld
67
# (normally) Automatically added by dh_installinit
68
if [ "$1" = "purge" ] ; then
69
update-rc.d mysql remove >/dev/null || exit 0
71
# (normally) End automatically added section
74
# (normally) Automatically added by dh_installdebconf
75
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
76
. /usr/share/debconf/confmodule
79
# (normally) End automatically added section
81
# no DEBHELPER here, "update-rc.d remove" fails if mysql-server-5.1 is installed