]> git.pld-linux.org Git - packages/mysql.git/commitdiff
- improved mysql old-passwords migration trigger
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 16 Jun 2005 13:44:33 +0000 (13:44 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- fixes cases when mysqld.conf was in clusterdir

Changed files:
    mysql.spec -> 1.279

mysql.spec

index 2202a08a1c19be80f7521fa0c9a66d210d1bbba7..c01dfec117573a683571ee9f5b332b7829eba430 100644 (file)
@@ -24,7 +24,7 @@ Summary(zh_CN):       MySQL
 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
@@ -74,6 +74,7 @@ Requires(pre):        /usr/sbin/useradd
 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
@@ -664,18 +665,25 @@ fi
 
 %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
This page took 0.039592 seconds and 4 git commands to generate.