summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2014-08-25 14:47:19 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-08-27 12:49:19 +0200
commit44834de2a3651cb84c8f46489fb6a5f75d6a6787 (patch)
treedd834a237c3b4a1f67c3f75d4347a13b50cfa372
parent5340cc8474a949952a8124a7352c17e7ea994cb3 (diff)
downloadmeta-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.service15
-rw-r--r--meta-oe/recipes-support/mysql/mariadb_5.5.38.inc20
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]
2Description=MariaDB database server
3After=syslog.target
4After=network.target
5
6[Service]
7Type=simple
8User=mysql
9Group=mysql
10ExecStart=@BINDIR@/mysqld_safe --basedir=@PREFIX@
11TimeoutSec=300
12PrivateTmp=true
13
14[Install]
15WantedBy=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
14SRC_URI[md5sum] = "fa9ba00b084b95a45fab70860c412f10" 15SRC_URI[md5sum] = "fa9ba00b084b95a45fab70860c412f10"
@@ -18,7 +19,7 @@ S = "${WORKDIR}/mariadb-${PV}"
18 19
19BINCONFIG_GLOB = "mysql_config" 20BINCONFIG_GLOB = "mysql_config"
20 21
21inherit cmake gettext binconfig update-rc.d useradd 22inherit cmake gettext binconfig update-rc.d useradd systemd
22 23
23INITSCRIPT_PACKAGES = "${PN}-server" 24INITSCRIPT_PACKAGES = "${PN}-server"
24INITSCRIPT_NAME = "mysqld" 25INITSCRIPT_NAME = "mysqld"
@@ -28,6 +29,10 @@ USERADD_PACKAGES = "${PN}-server"
28USERADD_PARAM_${PN}-server = "--system --home-dir /var/mysql -g mysql --shell /bin/false mysql" 29USERADD_PARAM_${PN}-server = "--system --home-dir /var/mysql -g mysql --shell /bin/false mysql"
29GROUPADD_PARAM_${PN}-server = "--system mysql" 30GROUPADD_PARAM_${PN}-server = "--system mysql"
30 31
32SYSTEMD_PACKAGES = "mariadb-server"
33SYSTEMD_SERVICE_mariadb-server = "mysqld.service"
34SYSTEMD_AUTO_ENABLE_mariadb-server = "disable"
35
31EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'" 36EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'"
32 37
33python __anonymous() { 38python __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
117pkg_postinst_${PN}-server () { 132pkg_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
252DESCRIPTION_${PN}-leftovers = "unpackaged and probably unneeded files for ${PN}" 268DESCRIPTION_${PN}-leftovers = "unpackaged and probably unneeded files for ${PN}"
253FILES_${PN}-leftovers = "/" 269FILES_${PN}-leftovers = "/"