SPECS: mysql.spec - improved mysql old-passwords migration trigger...

glen glen at pld-linux.org
Thu Jun 16 15:44:38 CEST 2005


Author: glen                         Date: Thu Jun 16 13:44:38 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- improved mysql old-passwords migration trigger
- fixes cases when mysqld.conf was in clusterdir

---- Files affected:
SPECS:
   mysql.spec (1.278 -> 1.279) 

---- Diffs:

================================================================
Index: SPECS/mysql.spec
diff -u SPECS/mysql.spec:1.278 SPECS/mysql.spec:1.279
--- SPECS/mysql.spec:1.278	Thu May 19 21:07:45 2005
+++ SPECS/mysql.spec	Thu Jun 16 15:44:33 2005
@@ -25,7 +25,7 @@
 Name:		mysql
 Group:		Applications/Databases
 Version:	4.1.12
-Release:	1
+Release:	1.1
 License:	GPL + MySQL FLOSS Exception
 Source0:	http://mysql.dataphone.se/Downloads/MySQL-4.1/%{name}-%{version}.tar.gz
 # Source0-md5:	56a6f5cacd97ae290e07bbe19f279af1
@@ -75,6 +75,7 @@
 Requires(postun):	/usr/sbin/userdel
 Requires(postun):	/usr/sbin/groupdel
 Requires(post,preun):	/sbin/chkconfig
+Requires(triggerpostun):	sed >= 4.0
 Requires:	%{name}-libs = %{version}-%{release}
 Requires:	/usr/bin/setsid
 Provides:	MySQL-server
@@ -665,18 +666,25 @@
 
 %triggerpostun -- mysql <= 4.1.1
 # For better compatibility with prevoius versions:
-for config in `grep -v "^#" /etc/mysql/clusters.conf | cut -d"=" -f 1`; do
+for config in $(awk -F= '!/^#/ && /=/{print $1}' /etc/mysql/clusters.conf); do
 	if echo "$config" | grep -q '^/'; then
 		config_file="$config"
 	elif [ -f "/etc/mysql/$config" ]; then
 		config_file=/etc/mysql/$config
 	else
+		clusterdir=$(awk -F= "/^$config/{print \$2}" /etc/mysql/clusters.conf)
 		config_file="$clusterdir/mysqld.conf"
 	fi
 	echo "Adding option old-passwords to config: $config_file"
 	echo "If you want to use new, better passwords - remove it"
-	echo "# Compatibility options:" >> $config_file
-	echo "old-passwords" >> $config_file
+
+	# sed magic to add 'old-passwords' to [mysqld] section
+	sed -i -e '/./{H;$!d;};x;/\[mysqld\]/{
+		a
+		a; Compatibility options:
+		aold-passwords
+	}
+	' $config_file
 done
 
 %files
@@ -845,6 +853,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.279  2005/06/16 13:44:33  glen
+- improved mysql old-passwords migration trigger
+- fixes cases when mysqld.conf was in clusterdir
+
 Revision 1.278  2005/05/19 19:07:45  glen
 - rel 1; STBR if you wish
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/mysql.spec?r1=1.278&r2=1.279&f=u




More information about the pld-cvs-commit mailing list