This file is indexed.

postinst is in percona-xtradb-cluster-server-5.7 5.7.20-29.24-0ubuntu2.

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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash

set -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 }

case "$1" in
configure)
    mysql_datadir=/usr/share/mysql
    mysql_statedir=/var/lib/percona-xtradb-cluster
    mysql_rundir=/var/run/mysqld
    mysql_logdir=/var/log
    mysql_cfgdir=/etc/mysql
    mysql_newlogdir=/var/log/mysql
    mysql_upgradedir=/var/lib/mysql-upgrade
    mysql_files=/var/lib/mysql-files

    # New packaging paradigm for my.cnf as of Dec-2014 for sharing mysql
    # variants in Ubuntu.
    /usr/share/mysql-common/configure-symlinks install percona-xtradb-cluster "$mysql_cfgdir/percona-xtradb-cluster.cnf"

    if [ -z "$2" ]; then

        if [ ! "$(ls -A ${mysql_statedir})" ] && [ -d ${mysql_files} ]; then
            db_get mysql-server/root_password && PASSWD=${RET}
            if [ ! -z "${PASSWD}" ]; then
                SQL=/var/lib/mysql-files/SQL
                touch ${SQL}
                chmod 600 ${SQL}
                chown mysql:mysql ${SQL}

                db_set mysql-server/root_password ""
                db_set mysql-server/root_password_again ""
                cat <<EOF >${SQL}
USE mysql;
UPDATE user SET authentication_string=PASSWORD('${PASSWD}') WHERE user='root';
EOF
                PASSWD=""
                su - mysql -s /bin/bash -c "/usr/sbin/mysqld --initialize-insecure=on --init-file=${SQL} 2>&1 > /dev/null"
                rm -f ${SQL}
            else
                SQL=/var/lib/mysql-files/SQL
                touch ${SQL}
                chmod 600 ${SQL}
                chown mysql:mysql ${SQL}
                cat <<EOF >${SQL}
INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
USE mysql;
UPDATE user SET plugin='auth_socket' WHERE user='root';
EOF
                su - mysql -s /bin/bash -c "/usr/sbin/mysqld --initialize-insecure=on --init-file=${SQL} 2>&1 > /dev/null"
                rm -f ${SQL}
            fi
        fi
    fi
    ;;

abort-upgrade | abort-remove | abort-configure) ;;

*)

    exit 1
    ;;
esac

db_stop

# Automatically added by dh_systemd_enable/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'mysql.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'mysql.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'mysql.service' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'mysql.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'mysql.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'mysql.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'mysql.service' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'mysql.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/mysql" ]; then
		update-rc.d mysql defaults 19 21 >/dev/null
		invoke-rc.d mysql start || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/mysql@" ]; then
		update-rc.d mysql@ defaults 19 21 >/dev/null
		invoke-rc.d mysql@ start || exit 1
	fi
fi
# End automatically added section


exit 0