[arch-commits] Commit in mysql/trunk (PKGBUILD mysqld)

Douglas Soares de Andrade douglas at archlinux.org
Mon Apr 13 18:30:00 EDT 2009


    Date: Monday, April 13, 2009 @ 18:30:00
  Author: douglas
Revision: 35546

upgpkg: mysql 5.1.33-2
    Applying Adam Strokes mysqld patch

Modified:
  mysql/trunk/PKGBUILD
  mysql/trunk/mysqld

----------+
 PKGBUILD |    4 ++--
 mysqld   |   32 +++++++++++++++++++++-----------
 2 files changed, 23 insertions(+), 13 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-04-13 20:58:59 UTC (rev 35545)
+++ PKGBUILD	2009-04-13 22:30:00 UTC (rev 35546)
@@ -4,7 +4,7 @@
 
 pkgname=mysql
 pkgver=5.1.33
-pkgrel=1
+pkgrel=2
 pkgdesc="A fast SQL database server"
 arch=(i686 x86_64)
 backup=(etc/my.cnf etc/conf.d/mysqld)
@@ -58,6 +58,6 @@
 md5sums=('9c5711e9bea4514df6f2659f283f0aa0'
          '8dce7e2b9f1f6ed6eca8bd62144bad0a'
          'd1921e85821a66196c24ef6e5346b572'
-         '247e9fa664bccaca62ca0e42a6cfae20'
+         'b3a888321bd974240527a4c182eb92f2'
          '0ee035590ffc61d32de994f461fd2bd2'
          '4a9077fc95ec6db1d5420e0cdc74d31c')

Modified: mysqld
===================================================================
--- mysqld	2009-04-13 20:58:59 UTC (rev 35545)
+++ mysqld	2009-04-13 22:30:00 UTC (rev 35546)
@@ -8,7 +8,12 @@
 . /etc/rc.conf
 . /etc/rc.d/functions
 
-PID=`pidof -o %PPID /usr/sbin/mysqld`
+getPID() {
+   if [ -f $MYSQLD_ROOT/$HOSTNAME.pid ]; then
+       echo `pidof -o %PPID /usr/sbin/mysqld`;
+   fi
+}
+
 if [ ! `egrep '^mysql:' /etc/group` ]; then
   stat_busy "Adding mysql group"
   groupadd -g 89 mysql
@@ -17,32 +22,37 @@
 if [ ! `egrep '^mysql:' /etc/passwd` ]; then
   stat_busy "Adding mysql user"
   useradd -u 89 -g mysql -d $MYSQLD_ROOT -s /bin/false mysql
-  [ -d $MYSQLD_ROOT ] && chown -R mysql.mysql $MYSQLD_ROOT
+  [ -d $MYSQLD_ROOT ] && chown -R mysql:mysql $MYSQLD_ROOT
   stat_done
 fi
 
 if [ ! -d $MYSQLD_ROOT ]; then
   mkdir $MYSQLD_ROOT
   /usr/bin/mysql_install_db --datadir=$MYSQLD_ROOT --user=mysql
-  chown -R mysql.mysql $MYSQLD_ROOT
+  chown -R mysql:mysql $MYSQLD_ROOT
 fi
 
 case "$1" in
   start)
     stat_busy "Starting MySQL"
-    if [ -z "$PID" ]; then
+    if [ -z "$(getPID)" ]; then
        /usr/bin/mysqld_safe --datadir=$MYSQLD_ROOT &>/dev/null &
       if [ $? -gt 0 ]; then
         stat_fail
         exit 1
       else
-        sleep 1 # wait on children
-        PID=`pidof -o %PPID /usr/sbin/mysqld`
-        if [ -z "$PID" ]; then
+        timeo=30
+        while [ $timeo -gt 0 ]; do
+          response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
+          echo "$response" | grep -q "mysqld is alive" && break
+          sleep 1
+          let timeo=${timeo}-1
+        done
+        if [ $timeo -eq 0 ]; then
           stat_fail
           exit 1
         else
-          echo $PID >/var/run/mysqld.pid
+          echo $(getPID) >/var/run/mysqld.pid
           add_daemon mysqld
           stat_done
         fi
@@ -55,8 +65,8 @@
 
   stop)
     stat_busy "Stopping MySQL"
-    if [ ! -z "$PID" ]; then
-      kill $PID &> /dev/null      
+    if [ ! -z "$(getPID)" ]; then
+      kill $(getPID) &> /dev/null
       if [ $? -gt 0 ]; then
         stat_fail
         exit 1
@@ -77,6 +87,6 @@
     $0 start
     ;;
   *)
-    echo "usage: $0 {start|stop|restart}"  
+    echo "usage: $0 {start|stop|restart}"
 esac
 exit 0



More information about the arch-commits mailing list