File: mysql-server.postrm

package info (click to toggle)
mysql 3.23.49-8.13
  • links: PTS
  • area: main
  • in suites: woody
  • size: 65,624 kB
  • ctags: 45,242
  • sloc: ansic: 255,722; cpp: 86,801; perl: 26,117; tcl: 19,882; sh: 18,775; asm: 4,001; yacc: 2,626; makefile: 2,494; java: 2,300; awk: 1,484; sed: 428
file content (39 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash -e

. /usr/share/debconf/confmodule
test $DEBIAN_SCRIPT_DEBUG && set -v -x

MYADMIN="/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf"
mysql_41_linkdir=/var/lib/mysql-upgrade

case "$1" in
  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    # for dpkg-reconfigure (no! but for what then? upgrading?)
    if [ -n "`$MYADMIN ping 2>/dev/null`" -a -x /etc/init.d/mysql ]; then
      /etc/init.d/mysql stop
      sleep 2
    fi
  ;;
  *)
    echo "postrm called with unknown argument '$1'" >&2
    exit 1
  ;;
esac

if [ "$1" = "purge" ]; then
  # we remove the mysql user only after all his owned files are purged
  rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}

  db_get mysql-server/postrm_remove_database || 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
    rm -rf $mysql_41_linkdir
    userdel mysql
  fi
fi

#DEBHELPER#