Commit Graph

18 Commits

Author SHA1 Message Date
Michael Heimpold 357fa2930c mariadb: minor whitespace and typo fixes
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
2023-12-22 14:09:27 +02:00
Michal Hrusecky 8f6831b64b mariadb: Drop unused rundir fix socket dir perms
We had been creating "rundir" but it was never used, probably leftover
from some removed function. At the same time, we were setting quite
strict rights to the socket directory (while comments sugested
otherwise).

Signed-off-by: Michal Hrusecky <michal@hrusecky.net>
2022-10-24 11:15:36 -07:00
Michal Hrusecky b41525cef4
mariadb: Check and fix datadir owner issues during upgrade
If you are migrating to MariaDB package, you might have old datadir
stored somewhere using different setup with different users. If you
trust us enough to enable autoupgrade, you probably trust us enough to
chown your datadir as well. This can prevent some potential issues.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2022-01-14 15:32:48 +01:00
Michal Hrusecky 1be35284bb mariadb: Init script improvements
Update init script so other user/group can be used. Also make sure that
init script can actually create an empty database instead of forcing the
user to do it by hand. Other new feature is taking care of migration
of the database when upgrading the database.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2021-11-29 01:47:45 -08:00
Michal Hrusecky c11f3948b8
mariadb: Cleanup and bump
Remove few no longer needed bits - like checking that datadir is defined
or mysqld_safe from server package and bumping revision after all the
init script cleanups.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-14 11:08:42 +02:00
Michal Hrusecky 595f0f1a2d
mariadb: Use procd and run as user
Drop mysqld_safe and use procd instead. Also run as a user.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-14 09:47:53 +02:00
Michal Hrusecky a01637ddf0
mariadb: Do not use mysqladmin in init
Rewrite init script as mysqladmin requires access to the MySQL which is
hard to guarantee. Use standard signals instead.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-13 08:58:29 +02:00
Michal Hrusecky 7c628580a6
mariadb: Use defaults and change default datadir
Use /srv/mysql as default datadir as /var/lib/mysql is in tmpfs. This
doesn't affect any existing setup as up till now it had to be always
specified in configuration. That is addressed in the second part of this
commit - init script now uses even defaults as compiled in MariaDB so
not everything has to be specified in configuration file.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-13 08:58:29 +02:00
Michal Hrusecky c35bd3aa8e
mariadb: Add shellcheck disable into init script
On few places, shellcheck gets confused by how some OpenWrt functions
work - especially load ones. Also on few places there are $options
variables that need not to be globbed. Could be rewritten better not to
need them, but I'll do major rewrites later in separate pull request.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-02 10:36:47 +02:00
Michal Hrusecky bb6e0d799c
mariadb: Use double quotes where possible
Just to make sure, add double quotes around strings and various
variables. In some cases it could prevent some issues, in other cases it
is just a good practice.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-02 10:06:38 +02:00
Michal Hrusecky 173314eb8f
mariadb: Handle non-existent logger in init
Make sure init script has a fallback when logger is not available.

Signed-off-by: Michal Hrusecky <michal.hrusecky@turris.com>
2020-10-01 16:02:42 +02:00
Sebastian Kemper fa6ea0b137 mariadb: switch init to mysqld_safe and mysqladmin
mysqld_safe is the recommended way to start the server on non-systemd
systems ([1]). For instance, it has a crash detection with auto-restart
function, can update ulimits, setup core files, set the niceness of the
server etc. It looks like it could also be helpful when trying to set up
clusters. It's maintained upstream and adding it means we don't need to
add these features into our init script.

mysqld_safe is a script itself, so it's added to conffiles in case users
want to edit it.

It can't be run under procd, so the init script is converted to a normal
System V type. To stop the server and to reload the privileges tables
mysqladmin is used. To that end mysqladmin is moved into the server
package.

While changing the init script, the Debian init script was used for
ideas. It wasn't copied verbatim and adapted a bit here and there.
Thanks to whoever wrote it!

This commit removes the support for starting the service as a user other
than "mariadb". This makes the init script simpler. If anybody wants to
play around with the user then it's up to them to fix the permissions.

[1] https://mariadb.com/kb/en/mysqld_safe/

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2020-05-12 00:13:11 +02:00
Sebastian Kemper a90561a90b mariadb: bump to major version 10.4
Highlights:

- Bump from 10.2.26 to 10.4.10
- auth_pam got replaced with never version, old one still available as
  auth_pam_v1
- semisync plugins were merged into the core
- Upstream now installs symlinks for binaries with mariadb prefix. To
  accommodate that this commit updates Package/mariadb/install/bin
  accordingly.
- Patches are updated with new ones from Debian and Arch (thanks!)
- libedit patch dropped because it's upstream now.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-17 15:48:25 +01:00
Sebastian Kemper 65036add44 mariadb: init script update
- added trailing '--' to logger to make it foolproof
- user is extracted from config instead of using hard-coded value
- log directory is now also extracted from config (if set)
- directory creation is now done via awk script (more robust)
- improved log messages

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-05-10 22:42:40 +02:00
Sebastian Kemper 2de1c6c05f mariadb: update init script to use uci
Does away with /etc/default/mysqld, introduces uci configuration
instead. The init script receives some further brushing up, like a
function (copied from Debian) to get mysqld configuration parameters
easily and quickly.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2018-12-15 17:17:24 +01:00
Sebastian Kemper 94f88d3d83 mariadb: convert init script to procd
Also create a user "mariadb" and use it for running the server. And
add possibility to easily add command line args.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2018-06-28 21:31:42 +02:00
Sebastian Kemper 3bdaa522df mariadb: fix /etc/mysql setup
- create directory /etc/mysql/conf.d as without it the server refuses to
  start
- correct the path to my.cnf in the init script

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2018-05-13 08:42:44 +02:00
Sebastian Kemper 1b73f267ea mariadb: new package
MariaDB is a drop-in replacement for MySQL. This commit adds a current
and stable version of MariaDB to the tree.

Quite a few ideas/patches were copied from Alpine Linux, Busybox Buildroot
and Debian.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2018-04-28 14:41:30 +02:00