diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2014-08-25 14:47:19 +0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2014-08-27 12:49:19 +0200 |
commit | 44834de2a3651cb84c8f46489fb6a5f75d6a6787 (patch) | |
tree | dd834a237c3b4a1f67c3f75d4347a13b50cfa372 | |
parent | 5340cc8474a949952a8124a7352c17e7ea994cb3 (diff) | |
download | meta-openembedded-44834de2a3651cb84c8f46489fb6a5f75d6a6787.tar.gz |
mariadb: add systemd unit file
The service file mainly comes from Fedora20.
This patch also adds a configuration file under /etc/tmpfiles.d so
that mysqld could start correctly.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r-- | meta-oe/recipes-support/mysql/mariadb/mysqld.service | 15 | ||||
-rw-r--r-- | meta-oe/recipes-support/mysql/mariadb_5.5.38.inc | 20 |
2 files changed, 33 insertions, 2 deletions
diff --git a/meta-oe/recipes-support/mysql/mariadb/mysqld.service b/meta-oe/recipes-support/mysql/mariadb/mysqld.service new file mode 100644 index 000000000..18ad8d54d --- /dev/null +++ b/meta-oe/recipes-support/mysql/mariadb/mysqld.service | |||
@@ -0,0 +1,15 @@ | |||
1 | [Unit] | ||
2 | Description=MariaDB database server | ||
3 | After=syslog.target | ||
4 | After=network.target | ||
5 | |||
6 | [Service] | ||
7 | Type=simple | ||
8 | User=mysql | ||
9 | Group=mysql | ||
10 | ExecStart=@BINDIR@/mysqld_safe --basedir=@PREFIX@ | ||
11 | TimeoutSec=300 | ||
12 | PrivateTmp=true | ||
13 | |||
14 | [Install] | ||
15 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/recipes-support/mysql/mariadb_5.5.38.inc b/meta-oe/recipes-support/mysql/mariadb_5.5.38.inc index 06c7ababd..bb17dc77a 100644 --- a/meta-oe/recipes-support/mysql/mariadb_5.5.38.inc +++ b/meta-oe/recipes-support/mysql/mariadb_5.5.38.inc | |||
@@ -9,6 +9,7 @@ SRC_URI = "http://mirror.stshosting.co.uk/mariadb/mariadb-${PV}/source/mariadb-$ | |||
9 | file://remove-bad-path.patch \ | 9 | file://remove-bad-path.patch \ |
10 | file://fix-mysqlclient-r-version.patch \ | 10 | file://fix-mysqlclient-r-version.patch \ |
11 | file://my.cnf \ | 11 | file://my.cnf \ |
12 | file://mysqld.service \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | SRC_URI[md5sum] = "fa9ba00b084b95a45fab70860c412f10" | 15 | SRC_URI[md5sum] = "fa9ba00b084b95a45fab70860c412f10" |
@@ -18,7 +19,7 @@ S = "${WORKDIR}/mariadb-${PV}" | |||
18 | 19 | ||
19 | BINCONFIG_GLOB = "mysql_config" | 20 | BINCONFIG_GLOB = "mysql_config" |
20 | 21 | ||
21 | inherit cmake gettext binconfig update-rc.d useradd | 22 | inherit cmake gettext binconfig update-rc.d useradd systemd |
22 | 23 | ||
23 | INITSCRIPT_PACKAGES = "${PN}-server" | 24 | INITSCRIPT_PACKAGES = "${PN}-server" |
24 | INITSCRIPT_NAME = "mysqld" | 25 | INITSCRIPT_NAME = "mysqld" |
@@ -28,6 +29,10 @@ USERADD_PACKAGES = "${PN}-server" | |||
28 | USERADD_PARAM_${PN}-server = "--system --home-dir /var/mysql -g mysql --shell /bin/false mysql" | 29 | USERADD_PARAM_${PN}-server = "--system --home-dir /var/mysql -g mysql --shell /bin/false mysql" |
29 | GROUPADD_PARAM_${PN}-server = "--system mysql" | 30 | GROUPADD_PARAM_${PN}-server = "--system mysql" |
30 | 31 | ||
32 | SYSTEMD_PACKAGES = "mariadb-server" | ||
33 | SYSTEMD_SERVICE_mariadb-server = "mysqld.service" | ||
34 | SYSTEMD_AUTO_ENABLE_mariadb-server = "disable" | ||
35 | |||
31 | EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'" | 36 | EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'" |
32 | 37 | ||
33 | python __anonymous() { | 38 | python __anonymous() { |
@@ -112,6 +117,16 @@ do_install() { | |||
112 | install -d ${D}/${sysconfdir}/init.d | 117 | install -d ${D}/${sysconfdir}/init.d |
113 | install -m 0644 ${WORKDIR}/my.cnf ${D}/${sysconfdir}/ | 118 | install -m 0644 ${WORKDIR}/my.cnf ${D}/${sysconfdir}/ |
114 | mv ${D}/${sysconfdir}/init.d/mysql ${D}/${sysconfdir}/init.d/mysqld | 119 | mv ${D}/${sysconfdir}/init.d/mysql ${D}/${sysconfdir}/init.d/mysqld |
120 | |||
121 | install -d ${D}${systemd_unitdir}/system | ||
122 | install -m 0644 ${WORKDIR}/mysqld.service ${D}${systemd_unitdir}/system | ||
123 | sed -i -e 's,@BINDIR@,${bindir},g' -e 's,@PREFIX@,${prefix},g' ${D}${systemd_unitdir}/system/mysqld.service | ||
124 | |||
125 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
126 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
127 | echo "f /var/log/mysqld.err 0640 mysql mysql -" \ | ||
128 | > ${D}${sysconfdir}/tmpfiles.d/99-mysqld.conf | ||
129 | fi | ||
115 | } | 130 | } |
116 | 131 | ||
117 | pkg_postinst_${PN}-server () { | 132 | pkg_postinst_${PN}-server () { |
@@ -247,7 +262,8 @@ FILES_${PN}-server = "\ | |||
247 | ${datadir}/mysql/ \ | 262 | ${datadir}/mysql/ \ |
248 | ${localstatedir}/mysql/ \ | 263 | ${localstatedir}/mysql/ \ |
249 | ${sysconfdir}/init.d \ | 264 | ${sysconfdir}/init.d \ |
250 | ${sysconfdir}/my.cnf" | 265 | ${sysconfdir}/my.cnf \ |
266 | ${sysconfdir}/tmpfiles.d" | ||
251 | 267 | ||
252 | DESCRIPTION_${PN}-leftovers = "unpackaged and probably unneeded files for ${PN}" | 268 | DESCRIPTION_${PN}-leftovers = "unpackaged and probably unneeded files for ${PN}" |
253 | FILES_${PN}-leftovers = "/" | 269 | FILES_${PN}-leftovers = "/" |