Skip to content

Instantly share code, notes, and snippets.

@glennpratt
Last active October 9, 2016 12:33
Show Gist options
  • Save glennpratt/319ca1440ae57d7f4060d8598b54997d to your computer and use it in GitHub Desktop.
Save glennpratt/319ca1440ae57d7f4060d8598b54997d to your computer and use it in GitHub Desktop.
percona-bug1507812

When upgrading to percona-server-server-5.6, mysql_install_db still runs:

+ apt-get install -y --allow-unauthenticated percona-server-server-5.6=5.6.32-78.1-1.xenial~1
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  libperconaserverclient18 percona-server-common-5.5
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libperconaserverclient18.1 percona-server-client-5.6
  percona-server-common-5.6
Suggested packages:
  tinyca
The following packages will be REMOVED:
  percona-server-client-5.5 percona-server-server-5.5
The following NEW packages will be installed:
  libperconaserverclient18.1 percona-server-client-5.6
  percona-server-common-5.6 percona-server-server-5.6
0 upgraded, 4 newly installed, 2 to remove and 4 not upgraded.
Need to get 1,940 kB/13.0 MB of archives.
After this operation, 29.7 MB of additional disk space will be used.
...
Setting up percona-server-server-5.6 (5.6.32-78.1-1.xenial~1) ...
Installing new version of config file /etc/init.d/mysql ...
<13>Oct  9 12:27:22 bug1507812: $0 == /var/lib/dpkg/info/percona-server-server-5.6.postinst
<13>Oct  9 12:27:22 bug1507812: $1 == configure
<13>Oct  9 12:27:22 bug1507812: $2 ==
<13>Oct  9 12:27:22 bug1507812: running mysql_install_db

...
diff --git a/DEBIAN/postinst b/DEBIAN/postinst
index 58af37f..cdbb99f 100755
--- a/DEBIAN/postinst
+++ b/DEBIAN/postinst
@@ -140,8 +140,12 @@ EOF
# initiate databases. Output is not allowed by debconf :-(
# Debian: beware of the bashisms...
# Don't run this on upgrades (#1507812, #1457614)
+ logger -t 'bug1507812' -s "\$0 == $0"
+ logger -t 'bug1507812' -s "\$1 == $1"
+ logger -t 'bug1507812' -s "\$2 == $2"
if [ -z "$2" ];
then
+ logger -t 'bug1507812' -s 'running mysql_install_db'
set +e
/usr//bin/mysql_install_db --user=mysql --rpm 2>&1 |
$ERR_LOGGER
set -xe
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export DEBIAN_FRONTEND=noninteractive
version='5.6.32-78.1-1.xenial'
patch_verson="${version}~1"
# apt-get purge -f -y libdbd-mysql-perl libmysqlclient20:amd64 libperconaserverclient18 libperconaserverclient18.1 mysql-common percona-release percona-server-client-5.6 percona-server-common-5.5 percona-server-common-5.6 percona-server-server-5.5 percona-server-server-5.6
# rm -f /var/lib/mysql/debian-*
wget -N https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
apt-get update
apt-get install -y aptitude
aptitude download percona-server-server-5.6=$version
dir=percona-bug1507812
rm -rf $dir
mkdir $dir
pushd $dir
pkg_dir=unpack
mkdir $pkg_dir
dpkg-deb -R ../percona-server-server*.deb $pkg_dir
pushd $pkg_dir
git apply "$script_dir/bug1507812-log.patch"
sed -i "s/^Version: ${version}$/Version: ${patch_verson}/" DEBIAN/control
popd
repo_dir=repo
mkdir $repo_dir
dpkg-deb -b $pkg_dir "${repo_dir}/percona-server-server-5.6_${patch_verson}.deb"
pushd $repo_dir
apt-ftparchive packages . > Packages && gzip < Packages > Packages.gz
echo "deb file://$PWD /" > /etc/apt/sources.list.d/percona-bug1507812.list
popd
apt-get update
apt-get install -y percona-server-server-5.5
apt-get install -y --allow-unauthenticated "percona-server-server-5.6=${patch_verson}"
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/xenial64'
config.vm.provision 'shell', inline: <<-SHELL
bash /vagrant/percona-bug1507812.sh
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment