Permalink
Browse files

preinst/postinst fixes to work along with existing commit #11f842510a…

…1473f50cb9eb955a92a0a69e45ace8

This handles the normal update-cases seamlessly, avoiding needless prompting the user!
  • Loading branch information...
1 parent 3671034 commit 02aa3a4b9d1c6a8c387606b5d540e66116a5e6ab @SimonIremonger SimonIremonger committed Aug 29, 2015
Showing with 32 additions and 0 deletions.
  1. +10 −0 deb/debian/mythtv-database.postinst
  2. +22 −0 deb/debian/mythtv-database.preinst
@@ -1,6 +1,7 @@
#!/bin/sh -e
MYSQL="/usr/share/mythtv/sql/mythtv*.sql"
MYSQLCONFIG="/etc/mysql/conf.d/mythtv.cnf"
+MYSQLCONFIGUPDATEHINT="/etc/mysql/conf.d/mythtv.cnf.ipv6update-with-public_bind.tmp"
FSTAB="/etc/fstab"
NEWIP="127.0.0.1"
LOCALHOSTNAME=`cat /etc/hostname`
@@ -48,6 +49,15 @@ update_database() {
case "$1" in
configure)
+
+ #Fixup mysql binding ipv6-compatibility config-update when public_bind was in use (hint from preinst)
+ if [ -f "${MYSQLCONFIG}" ]; then
+ if [ -f "${MYSQLCONFIGUPDATEHINT}" ]; then
+ sed -i -e 's/^#bind-address=::$/bind-address=::/' ${MYSQLCONFIG}
+ rm ${MYSQLCONFIGUPDATEHINT}
+ fi
+ fi
+
. /usr/share/debconf/confmodule
db_get mythtv/mysql_mythtv_dbname
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+MYSQLCONFIG="/etc/mysql/conf.d/mythtv.cnf"
+MYSQLCONFIGUPDATEHINT="/etc/mysql/conf.d/mythtv.cnf.ipv6update-with-public_bind.tmp"
+
+#This script (in combination with postinst amendment) purely to handle update-cases
+# from old installations with public_bind enabled so they seamlessly update without
+# generating needless "configuration modified by user" prompts.
+
+case "$1" in
+ upgrade)
+ if [ -f "${MYSQLCONFIG}" ]; then
+ if grep ^bind-address=0.0.0.0$ ${MYSQLCONFIG} > /dev/null; then
+ sed -i -e 's/^bind-address=0.0.0.0$/#bind-address=0.0.0.0/' ${MYSQLCONFIG}
+ echo "#" > ${MYSQLCONFIGUPDATEHINT}
+ fi
+ #in the case that public-binding was enabled, restore the original default-config, leaving
+ # a hint to the postinst which fixes this up upon postinst configure.
+ #only users who actually modified /etc/mysql/conf.d/mythtv.cnf manually will get prompted.
+ fi
+esac
+
+exit 0

0 comments on commit 02aa3a4

Please sign in to comment.