summaryrefslogtreecommitdiffstats
path: root/projectroot
diff options
context:
space:
mode:
authorBastian Stender <bst@pengutronix.de>2017-05-29 14:21:07 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-06-24 11:17:04 +0200
commit5e3dbbeede3cce78dc2a6cb8f2dd65fbee4ba059 (patch)
treee4f73c822ab698ab813d9e1872ae4c75434fde17 /projectroot
parent413eb50ff09da95e4bc715816fd4c851f7fb2861 (diff)
downloadptxdist-5e3dbbeede3cce78dc2a6cb8f2dd65fbee4ba059.tar.gz
ptxdist-5e3dbbeede3cce78dc2a6cb8f2dd65fbee4ba059.tar.xz
mariadb: new package
MariaDB is a MySQL fork. Therefore the MySQL rule was adapted to fit MariaDB. As MariaDB uses the same binary names as MySQL the packages conflict. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'projectroot')
-rw-r--r--projectroot/etc/mariadb/my.cnf24
-rw-r--r--projectroot/usr/lib/systemd/system/mariadb-init.service39
-rw-r--r--projectroot/usr/lib/systemd/system/mariadb.service27
3 files changed, 90 insertions, 0 deletions
diff --git a/projectroot/etc/mariadb/my.cnf b/projectroot/etc/mariadb/my.cnf
new file mode 100644
index 000000000..da402c47a
--- /dev/null
+++ b/projectroot/etc/mariadb/my.cnf
@@ -0,0 +1,24 @@
+# MariaDB config file for small systems.
+#
+# This is for a system with little memory where MariaDB is only used
+# from time to time and it's important that the mysqld daemon doesn't
+# use much resources.
+
+[mysqld]
+# These are commonly set, remove the # and set as required.
+#port = .....
+#socket = .....
+
+skip-external-locking
+key_buffer_size = 16K
+max_allowed_packet = 1M
+table_open_cache = 4
+sort_buffer_size = 64K
+read_buffer_size = 256K
+read_rnd_buffer_size = 256K
+net_buffer_length = 2K
+thread_stack = 240K
+
+# we have a read-only filesystem with one persistent writeable area only
+# so point to this single writeable location
+datadir = /var/lib/mysql/data
diff --git a/projectroot/usr/lib/systemd/system/mariadb-init.service b/projectroot/usr/lib/systemd/system/mariadb-init.service
new file mode 100644
index 000000000..af18afa0a
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/mariadb-init.service
@@ -0,0 +1,39 @@
+# Copyright (c) 2017, Pengutronix
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# MariaDB run-time preparation
+#
+# Preparation must be run once if the "data" (=working directory) does not
+# exist yet.
+# Since we expect a read-only root filesystem, we need one writeable filesystem
+# part at "/var/lib/mysql".
+#
+# Since we change some permissions, the script itself must run as user 'root'
+#
+
+[Unit]
+Description=MariaDB Server Initialization Service
+RequiresMountsFor=/var/lib/mysql
+ConditionPathExists=!/var/lib/mysql/data
+
+[Service]
+User=root
+Group=root
+Type=oneshot
+RemainAfterExit=yes
+
+ExecStart=/bin/chown -R mysql:mysql /var/lib/mysql
+ExecStart=/bin/chmod 0755 /var/lib/mysql
+
+ExecStart=/usr/scripts/mysql_install_db --basedir=/usr --datadir=/var/lib/mysql/data --user=mysql
+
+[Install]
+WantedBy=multi-user.target
diff --git a/projectroot/usr/lib/systemd/system/mariadb.service b/projectroot/usr/lib/systemd/system/mariadb.service
new file mode 100644
index 000000000..120bfefe6
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/mariadb.service
@@ -0,0 +1,27 @@
+[Unit]
+Description=MariaDB database server
+Requires=mariadb-init.service
+After=mariadb-init.service
+
+[Service]
+User=mysql
+Group=mysql
+PrivateDevices=true
+
+ExecStart=/usr/bin/mysqld
+
+KillMode=process
+KillSignal=SIGTERM
+SendSIGKILL=no
+
+Restart=on-abort
+RestartSec=5s
+
+UMask=007
+
+LimitNOFILE=5000
+
+[Install]
+WantedBy=multi-user.target
+Alias=mysql.service
+Alias=mysqld.service