* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
@ 2016-09-09 16:10 Floris Bos
2016-09-11 19:32 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Floris Bos @ 2016-09-09 16:10 UTC (permalink / raw)
To: buildroot
Add MYSQL_SOCKET variable with MySQL socket location
v3: fix systemd missing user
v2: move socket to /run/mysql/mysql.sock
chmod 755 /run/mysql to allow users access to it
---
package/mysql/S97mysqld | 2 +-
package/mysql/mysql.mk | 4 ++++
package/mysql/mysqld.service | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/package/mysql/S97mysqld b/package/mysql/S97mysqld
index 1d87e68..5a660e9 100644
--- a/package/mysql/S97mysqld
+++ b/package/mysql/S97mysqld
@@ -9,7 +9,7 @@ case "$1" in
# mysqld runs as user mysql, but /run is only writable by root
# so create a subdirectory for mysql.
- install -d -o mysql -g root -m 0700 /run/mysql
+ install -d -o mysql -g root -m 0755 /run/mysql
# We don't use start-stop-daemon because mysqld has
# its own wrapper script.
diff --git a/package/mysql/mysql.mk b/package/mysql/mysql.mk
index 534bd97..7af4711 100644
--- a/package/mysql/mysql.mk
+++ b/package/mysql/mysql.mk
@@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
MYSQL_LICENSE = GPLv2
MYSQL_LICENSE_FILES = README COPYING
+# Unix socket. This variable can also be consulted by other buildroot packages
+MYSQL_SOCKET = /run/mysql/mysql.sock
+
MYSQL_CONF_ENV = \
ac_cv_sys_restartable_syscalls=yes \
ac_cv_path_PS=/bin/ps \
@@ -31,6 +34,7 @@ MYSQL_CONF_OPTS = \
--without-readline \
--with-low-memory \
--enable-thread-safe-client \
+ --with-unix-socket-path=$(MYSQL_SOCKET) \
--disable-mysql-maintainer-mode
# host-mysql only installs what is needed to build mysql, i.e. the
diff --git a/package/mysql/mysqld.service b/package/mysql/mysqld.service
index 2ded9c2..c9e5e42 100644
--- a/package/mysql/mysqld.service
+++ b/package/mysql/mysqld.service
@@ -5,6 +5,9 @@ Description=MySQL database server
ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
ExecStart=/usr/bin/mysqld_safe
Restart=always
+User=mysql
+RuntimeDirectory=mysql
+RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
2016-09-09 16:10 Floris Bos
@ 2016-09-11 19:32 ` Thomas Petazzoni
2016-09-11 20:25 ` Floris Bos
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-09-11 19:32 UTC (permalink / raw)
To: buildroot
Hello,
On Fri, 9 Sep 2016 18:10:47 +0200, Floris Bos wrote:
> Add MYSQL_SOCKET variable with MySQL socket location
>
> v3: fix systemd missing user
> v2: move socket to /run/mysql/mysql.sock
> chmod 755 /run/mysql to allow users access to it
This patch lacks your Signed-off-by line.
Also, this patch defines the MYSQL_SOCKET variable, which in PATCH 2/2
gets used in the PHP package. Sharing variables between packages
doesn't work in all situations, so we usually refrain from doing so.
Maybe we should document in the manual which cases work and which cases
don't work. Cc'ing Arnout, who knows quite a bit about this topic :)
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
2016-09-11 19:32 ` Thomas Petazzoni
@ 2016-09-11 20:25 ` Floris Bos
2016-09-11 20:54 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Floris Bos @ 2016-09-11 20:25 UTC (permalink / raw)
To: buildroot
On 09/11/2016 09:32 PM, Thomas Petazzoni wrote:
> Hello,
>
> On Fri, 9 Sep 2016 18:10:47 +0200, Floris Bos wrote:
>> Add MYSQL_SOCKET variable with MySQL socket location
>>
>> v3: fix systemd missing user
>> v2: move socket to /run/mysql/mysql.sock
>> chmod 755 /run/mysql to allow users access to it
> This patch lacks your Signed-off-by line.
>
> Also, this patch defines the MYSQL_SOCKET variable, which in PATCH 2/2
> gets used in the PHP package. Sharing variables between packages
> doesn't work in all situations, so we usually refrain from doing so.
> Maybe we should document in the manual which cases work and which cases
> don't work. Cc'ing Arnout, who knows quite a bit about this topic :)
Ah, didn't know.
Thought that always all package .mk files were included, and that
variable expansion was deferred until actual use when created with the =
operator (as opposed to := )
Anyway, if you prefer to do without variable, and have the value
hardcoded at both places, that's fine with me as well.
Yours sincerely,
Floris Bos
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
2016-09-11 20:25 ` Floris Bos
@ 2016-09-11 20:54 ` Thomas Petazzoni
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2016-09-11 20:54 UTC (permalink / raw)
To: buildroot
Hello,
On Sun, 11 Sep 2016 22:25:08 +0200, Floris Bos wrote:
> On 09/11/2016 09:32 PM, Thomas Petazzoni wrote:
> > Hello,
> >
> > On Fri, 9 Sep 2016 18:10:47 +0200, Floris Bos wrote:
> >> Add MYSQL_SOCKET variable with MySQL socket location
> >>
> >> v3: fix systemd missing user
> >> v2: move socket to /run/mysql/mysql.sock
> >> chmod 755 /run/mysql to allow users access to it
> > This patch lacks your Signed-off-by line.
> >
> > Also, this patch defines the MYSQL_SOCKET variable, which in PATCH 2/2
> > gets used in the PHP package. Sharing variables between packages
> > doesn't work in all situations, so we usually refrain from doing so.
> > Maybe we should document in the manual which cases work and which cases
> > don't work. Cc'ing Arnout, who knows quite a bit about this topic :)
>
> Ah, didn't know.
> Thought that always all package .mk files were included, and that
> variable expansion was deferred until actual use when created with the =
> operator (as opposed to := )
>
> Anyway, if you prefer to do without variable, and have the value
> hardcoded at both places, that's fine with me as well.
Just discussed this with Yann, and this particular usage is OK, so
patches are good.
Can you resend with:
1. Your Signed-off-by line added.
2. The changelog below the "---" sign (which itself should be after
the Signed-off-by line). See
https://patchwork.ozlabs.org/patch/668485/ for a good example.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
@ 2016-09-13 22:03 Floris Bos
2016-09-13 22:03 ` [Buildroot] [PATCH v3 2/2] package/php: set MySQL socket path Floris Bos
2016-09-18 17:54 ` [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Thomas Petazzoni
0 siblings, 2 replies; 7+ messages in thread
From: Floris Bos @ 2016-09-13 22:03 UTC (permalink / raw)
To: buildroot
Add MYSQL_SOCKET variable with MySQL socket location
Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
Changes v2 -> v3:
- fix systemd unit file missing User
Changes v1 -> v2:
- move socket to /run/mysql/mysql.sock
chmod 755 /run/mysql to allow users access to it
---
package/mysql/S97mysqld | 2 +-
package/mysql/mysql.mk | 4 ++++
package/mysql/mysqld.service | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/package/mysql/S97mysqld b/package/mysql/S97mysqld
index 1d87e68..5a660e9 100644
--- a/package/mysql/S97mysqld
+++ b/package/mysql/S97mysqld
@@ -9,7 +9,7 @@ case "$1" in
# mysqld runs as user mysql, but /run is only writable by root
# so create a subdirectory for mysql.
- install -d -o mysql -g root -m 0700 /run/mysql
+ install -d -o mysql -g root -m 0755 /run/mysql
# We don't use start-stop-daemon because mysqld has
# its own wrapper script.
diff --git a/package/mysql/mysql.mk b/package/mysql/mysql.mk
index 534bd97..7af4711 100644
--- a/package/mysql/mysql.mk
+++ b/package/mysql/mysql.mk
@@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
MYSQL_LICENSE = GPLv2
MYSQL_LICENSE_FILES = README COPYING
+# Unix socket. This variable can also be consulted by other buildroot packages
+MYSQL_SOCKET = /run/mysql/mysql.sock
+
MYSQL_CONF_ENV = \
ac_cv_sys_restartable_syscalls=yes \
ac_cv_path_PS=/bin/ps \
@@ -31,6 +34,7 @@ MYSQL_CONF_OPTS = \
--without-readline \
--with-low-memory \
--enable-thread-safe-client \
+ --with-unix-socket-path=$(MYSQL_SOCKET) \
--disable-mysql-maintainer-mode
# host-mysql only installs what is needed to build mysql, i.e. the
diff --git a/package/mysql/mysqld.service b/package/mysql/mysqld.service
index 2ded9c2..c9e5e42 100644
--- a/package/mysql/mysqld.service
+++ b/package/mysql/mysqld.service
@@ -5,6 +5,9 @@ Description=MySQL database server
ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
ExecStart=/usr/bin/mysqld_safe
Restart=always
+User=mysql
+RuntimeDirectory=mysql
+RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 2/2] package/php: set MySQL socket path
2016-09-13 22:03 [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
@ 2016-09-13 22:03 ` Floris Bos
2016-09-18 17:54 ` [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Floris Bos @ 2016-09-13 22:03 UTC (permalink / raw)
To: buildroot
Set the PHP default MySQL socket path to match what the
mysql package is using.
Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
package/php/php.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/package/php/php.mk b/package/php/php.mk
index 7df10be..1ea47f2 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -211,6 +211,11 @@ PHP_DEPENDENCIES += unixodbc
endif
endif
+ifneq ($(BR2_PACKAGE_PHP_EXT_MYSQLI)$(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),)
+# Set default MySQL unix socket to what the MySQL server is using by default
+PHP_CONF_OPTS += --with-mysql-sock=$(MYSQL_SOCKET)
+endif
+
define PHP_DISABLE_PCRE_JIT
$(SED) '/^#define SUPPORT_JIT/d' $(@D)/ext/pcre/pcrelib/config.h
endef
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable
2016-09-13 22:03 [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
2016-09-13 22:03 ` [Buildroot] [PATCH v3 2/2] package/php: set MySQL socket path Floris Bos
@ 2016-09-18 17:54 ` Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2016-09-18 17:54 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 14 Sep 2016 00:03:50 +0200, Floris Bos wrote:
> Add MYSQL_SOCKET variable with MySQL socket location
>
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
>
> ---
> Changes v2 -> v3:
> - fix systemd unit file missing User
Both patches applied to master, thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-18 17:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13 22:03 [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Floris Bos
2016-09-13 22:03 ` [Buildroot] [PATCH v3 2/2] package/php: set MySQL socket path Floris Bos
2016-09-18 17:54 ` [Buildroot] [PATCH v3 1/2] package/mysql: add MYSQL_SOCKET variable Thomas Petazzoni
-- strict thread matches above, loose matches on Subject: below --
2016-09-09 16:10 Floris Bos
2016-09-11 19:32 ` Thomas Petazzoni
2016-09-11 20:25 ` Floris Bos
2016-09-11 20:54 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox