Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2002 01:49:25 +0200
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        dirk@FreeBSD.org
Cc:        ports@FreeBSD.org
Subject:   Improving startup/shutdown script for MySQL and fixing build on -current [patch]
Message-ID:  <20021107234925.GA2877@vega.vega.com>

next in thread | raw e-mail | index | archive | help

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

Hi there,

Pease review/approve attached patch, which improves startup/shutdown
script for MySQL (currently it doesn't work properly when there are
several independent MySQL servers running on the same machine), as
well as fixes build error on 5-current.

Thank you in advance!

-Maxim

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename="mysql.diff"

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/databases/mysql323-server/Makefile,v
retrieving revision 1.144
diff -d -u -r1.144 Makefile
--- Makefile	21 Oct 2002 09:22:13 -0000	1.144
+++ Makefile	7 Nov 2002 21:16:08 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME?=	${MASTERPORTNAME}
 PORTVERSION=	3.23.53
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	databases
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE} \
 		http://www.kernelnotes.de/MySQL/Downloads/MySQL-3.23/ \
@@ -136,7 +136,7 @@
 .endif
 	@${SETENV} DB_DIR=${DB_DIR} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 .endif
-	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/mysql-server.sh > ${PREFIX}/etc/rc.d/mysql-server.sh
+	@${SED} "s|%%PREFIX%%|${PREFIX}|g ; s|%%DB_DIR%%|${DB_DIR}|g" < ${FILESDIR}/mysql-server.sh > ${PREFIX}/etc/rc.d/mysql-server.sh
 	@${CHMOD} 750 ${PREFIX}/etc/rc.d/mysql-server.sh
 
 .if !defined(NOPORTDOCS)
Index: files/mysql-server.sh
===================================================================
RCS file: /home/ncvs/ports/databases/mysql323-server/files/mysql-server.sh,v
retrieving revision 1.3
diff -d -u -r1.3 mysql-server.sh
--- files/mysql-server.sh	7 Aug 2002 19:51:47 -0000	1.3
+++ files/mysql-server.sh	7 Nov 2002 21:16:08 -0000
@@ -1,14 +1,20 @@
 #!/bin/sh
 
+PIDFILE=%%DB_DIR%%/mysql.pid
+
 case "$1" in
 	start)
 		if [ -x %%PREFIX%%/bin/safe_mysqld ]; then
-			%%PREFIX%%/bin/safe_mysqld --user=mysql > /dev/null &
+			%%PREFIX%%/bin/safe_mysqld --user=mysql --pid-file=${PIDFILE} > /dev/null &
 			echo -n ' mysqld'
 		fi
 		;;
 	stop)
-		/usr/bin/killall mysqld > /dev/null 2>&1 && echo -n ' mysqld'
+		if [ -f ${PIDFILE} ]; then
+			/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
+		else
+			echo "mysql-server isn't running"
+		fi
 		;;
 	*)
 		echo ""
Index: files/patch-af
===================================================================
RCS file: /home/ncvs/ports/databases/mysql323-server/files/patch-af,v
retrieving revision 1.11
diff -d -u -r1.11 patch-af
--- files/patch-af	20 Jun 2002 14:47:47 -0000	1.11
+++ files/patch-af	7 Nov 2002 21:16:08 -0000
@@ -1,5 +1,8 @@
---- scripts/safe_mysqld.sh.orig	Mon Jun  3 12:39:02 2002
-+++ scripts/safe_mysqld.sh	Mon Jun 17 19:07:26 2002
+
+$FreeBSD$
+
+--- scripts/safe_mysqld.sh.orig	Wed Aug 14 01:08:14 2002
++++ scripts/safe_mysqld.sh	Thu Nov  7 13:36:44 2002
 @@ -68,30 +68,9 @@
    done
  }
@@ -34,7 +37,15 @@
  
  MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}
  MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
-@@ -239,34 +218,6 @@
+@@ -106,7 +85,6 @@
+ fi
+ 
+ # these rely on $DATADIR by default, so we'll set them later on
+-pid_file=
+ err_log=
+ SET_USER=0
+ 
+@@ -239,34 +217,6 @@
    if test ! -f $pid_file		# This is removed if normal shutdown
    then
      break
Index: files/patch-sql::mysqld.cc
===================================================================
RCS file: files/patch-sql::mysqld.cc
diff -N files/patch-sql::mysqld.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-sql::mysqld.cc	7 Nov 2002 21:16:08 -0000
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- sql/mysqld.cc	2002/11/07 12:08:35	1.1
++++ sql/mysqld.cc	2002/11/07 12:09:23
+@@ -92,7 +92,7 @@
+ int allow_severity = LOG_INFO;
+ int deny_severity = LOG_WARNING;
+ 
+-#ifdef __STDC__
++#if defined(__STDC__) && !defined(__FreeBSD__)
+ #define my_fromhost(A)	   fromhost(A)
+ #define my_hosts_access(A) hosts_access(A)
+ #define my_eval_client(A)  eval_client(A)

--HlL+5n6rz5pIUxbD--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021107234925.GA2877>