This file is indexed.

postrm is in mariadb-server-10.1 1:10.1.29-6.

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 -e

. /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 }

#
# - Purge logs and data only if they are ours (#307473)
# - Remove the mysql user only after all his owned files are purged.
# - Cleanup the initscripts only if this was the last provider of them
#
if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-10.1.flag" ]; 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 mariadb-server-10.1/postrm_remove_databases || true
  db_go || true
  db_get mariadb-server-10.1/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
    # 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.
    # Attempt removal only if the directory hasn't already been removed
    # by dpkg to avoid failing on "No such file or directory" errors.
    if [ -d /var/lib/mysql ]
    then
      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
    fi
    rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind
    userdel mysql || true
  fi

  # Automatically added by dh_installinit/10.10.9ubuntu1
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_systemd_enable/10.10.9ubuntu1
if [ "$1" = "remove" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper mask 'mariadb.service' >/dev/null
	fi
fi

if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'mariadb.service' >/dev/null
		deb-systemd-helper unmask 'mariadb.service' >/dev/null
	fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/10.10.9ubuntu1
if [ "$1" = "remove" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper mask 'mariadb.service' >/dev/null
	fi
fi

if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'mariadb.service' >/dev/null
		deb-systemd-helper unmask 'mariadb.service' >/dev/null
	fi
fi
# End automatically added section
# Automatically added by dh_installdebconf/10.10.9ubuntu1
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section


fi

# Modified dh_systemd_start snippet that's not added automatically due /etc/init.d/mysql
if [ -d /run/systemd/system ]; then
	systemctl --system daemon-reload >/dev/null || true
fi

exit 0