Skip to contentSkip to conversation

mysql: fix missing directory

PATCH New Marcelo Gutiérrez 2 participants 11 messages Mar 4, 2014 – Jul 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mysql: fix missing directory

---
 package/mysql/mysql.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/mysql/mysql.mk +7 -0
index 95b30b7..eb3a70e 100644
@@ -40,6 +40,7 @@ HOST_MYSQL_CONF_OPT = \
 	--with-embedded-server
 
 MYSQL_CONF_OPT += \
+	--localstatedir=/var/mysql \
 	--disable-dependency-tracking \
 	--with-atomic-ops=up \
 	--with-embedded-server \
@@ -78,6 +79,12 @@ define HOST_MYSQL_INSTALL_CMDS
 	$(INSTALL) -m 0755  $(@D)/sql/gen_lex_hash  $(HOST_DIR)/usr/bin/
 endef
 
+define MYSQL_ADD_FOLDER
+	$(INSTALL) -d $(TARGET_DIR)/var/mysql
+endef
+
+MYSQL_POST_INSTALL_TARGET_HOOKS += MYSQL_ADD_FOLDER
+
 else
 MYSQL_CONF_OPT += \
 	--without-server
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/4 mysql: add mysql user

---
 package/mysql/mysql.mk |    4 ++++
 1 file changed, 4 insertions(+)
package/mysql/mysql.mk +4 -0
index eb3a70e..3b69bdc 100644
@@ -79,6 +79,10 @@ define HOST_MYSQL_INSTALL_CMDS
 	$(INSTALL) -m 0755  $(@D)/sql/gen_lex_hash  $(HOST_DIR)/usr/bin/
 endef
 
+define MYSQL_USERS
+	mysql -1 nogroup -1 = /var/mysql /bin/sh -
+endef
+
 define MYSQL_ADD_FOLDER
 	$(INSTALL) -d $(TARGET_DIR)/var/mysql
 endef
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/4 mysql: add mysql user

Dear Marcelo Guti?rrez,

package/mysql/mysql.mk define HOST_MYSQL_INSTALL_CMDS · line 84

Quoted 3 lines · Marcelo Guti?rrez
package/mysql/mysql.mk +3 -0
+define MYSQL_USERS
+	mysql -1 nogroup -1 = /var/mysql /bin/sh -
+endef

I've changed = to * to generate an user that cannot log in. I've changed /bin/sh to - because there's no point in having a shell defined. And I've added a description of the user.

Applied with those changes, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 3/4 mysql: add mysql init script

In reply to Marcelo Gutiérrez
---
 package/mysql/S97mysqld |   22 ++++++++++++++++++++++
 package/mysql/mysql.mk  |    5 +++++
 2 files changed, 27 insertions(+)
 create mode 100644 package/mysql/S97mysqld
package/mysql/S97mysqld new file +22 -0
new file mode 100644
index 0000000..91ddb44
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+#MySQL init script.
+#
+case "$1" in
+	start)
+		/usr/bin/mysqld_safe &
+		;;
+	stop)
+		if test -f /var/lib/mysql/mysqld.pid ; then
+			PID=`cat /var/lib/mysql/mysqld.pid`
+			kill $PID
+		fi
+		;;
+	restart)
+		"$0" stop
+		"$0" start
+		;;
+	*)
+		echo "Usage: /etc/init.d/mysqld {start|stop|restart}"
+		;;
+esac
package/mysql/mysql.mk +5 -0
index 3b69bdc..c35fef5 100644
@@ -89,6 +89,11 @@ endef
 
 MYSQL_POST_INSTALL_TARGET_HOOKS += MYSQL_ADD_FOLDER
 
+define MYSQL_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/mysql/S97mysqld \
+		$(TARGET_DIR)/etc/init.d/S97mysqld
+endef
+
 else
 MYSQL_CONF_OPT += \
 	--without-server
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 3/4 mysql: add mysql init script

Dear Marcelo Guti?rrez,

package/mysql/S97mysqld line 7

Quoted 3 lines · Marcelo Guti?rrez
package/mysql/S97mysqld new file +3 -0
+case "$1" in
+	start)
+		/usr/bin/mysqld_safe &

I've added a call to mysql_install_db on the first boot, to generate the MySQL system tables, otherwise the server refuses to start. I've also used --pid-file when calling mysqld_safe to explicitly specify where the pid file should be stored, because...

package/mysql/S97mysqld line 11

Quoted 4 lines
package/mysql/S97mysqld new file +4 -0
+		;;
+	stop)
+		if test -f /var/lib/mysql/mysqld.pid ; then
+			PID=`cat /var/lib/mysql/mysqld.pid`

... it wasn't stored there, so I fixed that up as well.

Committed with those changes, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 4/4 mysql: host-mysql depends on host-zlib

In reply to Marcelo Gutiérrez
---
 package/mysql/mysql.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/mysql/mysql.mk +1 -1
index c35fef5..9a8612b 100644
@@ -34,7 +34,7 @@ MYSQL_CONF_OPT = \
 
 ifeq ($(BR2_PACKAGE_MYSQL_SERVER),y)
 MYSQL_DEPENDENCIES += host-mysql host-bison
-HOST_MYSQL_DEPENDENCIES =
+HOST_MYSQL_DEPENDENCIES = host-zlib
 
 HOST_MYSQL_CONF_OPT = \
 	--with-embedded-server
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 4/4 mysql: host-mysql depends on host-zlib

Dear Marcelo Guti?rrez,

Quoted 11 lines · Marcelo Guti?rrez
---
 package/mysql/mysql.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/mysql/mysql.mk +0 -0
index c35fef5..9a8612b 100644

package/mysql/mysql.mk MYSQL_CONF_OPT = \ · line 37

Quoted 5 lines
package/mysql/mysql.mk +1 -1
@@ -34,7 +34,7 @@ MYSQL_CONF_OPT = \
 
 ifeq ($(BR2_PACKAGE_MYSQL_SERVER),y)
 MYSQL_DEPENDENCIES += host-mysql host-bison
-HOST_MYSQL_DEPENDENCIES =
+HOST_MYSQL_DEPENDENCIES = host-zlib

Hum, why? I have built the mysql server successfully without this patch. Can you give some details about why this is needed?

And by the way, thanks a lot for the patches!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH 4/4 mysql: host-mysql depends on host-zlib

Hi Thomas, all.

Hum, why? I have built the mysql server successfully without this

Quoted 2 lines

patch. Can you give some details about why this is needed?

I downloaded a fresh "git buildroot" and I've only selected MySQL client and MySQL server.

When it was compiling "host-mysql", could not find "libzlt.la" library.

So I've added host-zlib and that issue completely gone.

Regards,
Marcelo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140304/cba326e5/attachment.html>

#8 lore raw

PATCH 4/4 mysql: host-mysql depends on host-zlib

Hi Thomas,

Quoted 7 lines

I downloaded a fresh "git buildroot" and I've only selected MySQL client and MySQL server.

When it was compiling "host-mysql", could not find "libzlt.la" library.

So I've added host-zlib and that issue completely gone.

More details about host-zlib dependency....

I'm using a Debian distro and if remove "zlib1g-dev" package. I got the following error message without host-zlib.

libtool: link: cannot find the library ../zlib/libzlt.la' or unhandled argument ../zlib/libzlt.la'

Therefore, zlib1g-dev makes the difference.

Regards,
Marcelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140304/72838d63/attachment.html>

#9 lore raw

PATCH 4/4 mysql: host-mysql depends on host-zlib

In reply to Marcelo Gutiérrez

Dear Marcelo Guti?rrez,

Quoted 5 lines · Marcelo Guti?rrez
---
 package/mysql/mysql.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks. I've added a reference to the autobuilder issue being fixed by this commit. Next time, make sure to include such a reference. Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com