This file is indexed.

postrm is in percona-xtradb-cluster-server-5.6 5.6.21-25.8-0ubuntu3.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#!/bin/bash
set -e

# It is possible that Debconf has already been removed, too.
if [ -f /usr/share/debconf/confmodule ]; then
  . /usr/share/debconf/confmodule
fi

mysql_cfgdir=/etc/mysql
PERCONA_PREFIX=/usr
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin:$PERCONA_PREFIX/bin

if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }

MYADMIN="${PERCONA_PREFIX}/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"

# 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!
stop_server() {
  set +e
  if [ -x /usr/sbin/invoke-rc.d ]; then
    invoke-rc.d mysql stop
  else
    /etc/init.d/mysql stop
  fi
  errno=$?
  set -e

  if [ "$?" != 0 ]; then
    echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
    echo "Stop it yourself and try again!" 1>&2
    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

# New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
# variants in Ubuntu.
case "$1" in
  remove|disappear)
    /usr/share/mysql-common/configure-symlinks remove percona-xtradb-cluster "$mysql_cfgdir/percona-xtradb-cluster.cnf"
  ;;
esac

#
# - Do NOT purge logs or data if another percona-xtradb-cluster-server* 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.5/postrm_remove_databases || true
  db_go || true
  db_get mysql-server-5.5/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/percona-xtradb-cluster
    rm -rf /var/run/mysqld
    userdel mysql || true
  fi
fi

# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
	update-rc.d mysql remove >/dev/null
fi


# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section


exit 0