[packages/mariadb] Rel 4. Fix init and the /etc/mariadb file conflict
arekm
arekm at pld-linux.org
Fri Oct 30 21:27:41 CET 2026
commit ddf186992123fe5ce03fd5ee6bac87a541bc8a02
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri Oct 30 16:06:32 2026 +0100
Rel 4. Fix init and the /etc/mariadb file conflict
mariadb.init | 49 ++++++++++++++++---------------------------------
mariadb.spec | 7 +++----
mysql-clusters.conf | 4 ++--
3 files changed, 21 insertions(+), 39 deletions(-)
---
diff --git a/mariadb.spec b/mariadb.spec
index d757743..1b80f33 100644
--- a/mariadb.spec
+++ b/mariadb.spec
@@ -31,13 +31,13 @@ Summary(uk.UTF-8): MariaDB - швидкий SQL-сервер
Summary(zh_CN.UTF-8): MariaDB数据库服务器
Name: mariadb
Version: 12.3.3
-Release: 3
+Release: 4
License: GPL + MariaDB FLOSS Exception
Group: Applications/Databases
# Source0: https://downloads.mariadb.org/f/%{name}-%{version}/source/%{name}-%{version}.tar.gz
Source0: https://rsync.osuosl.org/pub/mariadb/%{name}-%{version}/source/%{name}-%{version}.tar.gz
# Source0-md5: 83d962d0f5917a0445786cc31337b118
-Source100: http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz
+Source100: https://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz
# Source100-md5: 5cac34f3d78a9d612ca4301abfcbd666
Source1: mariadb.init
Source2: mariadb.sysconfig
@@ -835,7 +835,6 @@ fi
#%dir %{_docdir}/%{name}-%{version}
#%attr(644,root,root) %{_docdir}/%{name}-%{version}/*
-%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/conf.d
%{_sysconfdir}/%{name}/conf.d/client.cnf
%{_sysconfdir}/%{name}/conf.d/enable_encryption.preset
@@ -865,7 +864,7 @@ fi
%attr(700,mysql,mysql) %{_mysqlhome}
# root:root is proper here for mysql.rpm while mysql:mysql is potential security hole
-#%attr(751,root,root) /var/lib/mysql
+%attr(751,root,root) %dir /var/lib/%{name}
%attr(750,mysql,mysql) %dir /var/log/%{name}
%attr(750,mysql,mysql) %dir /var/log/archive/%{name}
%attr(640,mysql,mysql) %ghost /var/log/%{name}/*
diff --git a/mariadb.init b/mariadb.init
index 155381a..0c76154 100644
--- a/mariadb.init
+++ b/mariadb.init
@@ -125,7 +125,7 @@ mysqlstatus() {
fi
if [ "$mode" = "start" ]; then
- MYSQL_GREP_PID=$(grep -lE "^/usr/sbin/mariadbd.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
+ MYSQL_GREP_PID=$(grep -alE "^/usr/sbin/mariadbd.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
if [ -n "$MYSQL_GREP_PID" ]; then
MYSQL_PID=$MYSQL_GREP_PID
if grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null; then
@@ -156,19 +156,13 @@ mysqlstatus() {
mysqlgetconfig() {
clusterdir="$1"
- # emulate old behaviour if only one cluster specified
- if [ "$clusterdir" = "$MARIADB_DB_CLUSTERS" -a "$clusterdir" = "/var/lib/mariadb" -a -f /etc/mysqld.conf ]; then
- MYSQL_RA_COMPAT=yes
- config_file=/etc/mysqld.conf
+ config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mariadb/clusters.conf)
+ if [[ $config = /* ]]; then
+ config_file="$config"
+ elif [ -f "/etc/mariadb/$config" ]; then
+ config_file="/etc/mariadb/$config"
else
- config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mariadb/clusters.conf)
- if [[ $config = /* ]]; then
- config_file="$config"
- elif [ -f "/etc/mariadb/$config" ]; then
- config_file="/etc/mariadb/$config"
- else
- config_file="$clusterdir/mysqld.conf"
- fi
+ config_file="$clusterdir/mysqld.conf"
fi
MYSQL_CLUSTER_DIR="$clusterdir"
@@ -205,20 +199,14 @@ section == "mysqld" && $2 ~ "=" {
' $config_file`
- if is_yes "$MYSQL_RA_COMPAT"; then
- MYSQL_DATA_DIR_SUB=""
- else
- MYSQL_DATA_DIR_SUB="/mysqldb"
- fi
-
- if [ -z "$MYSQL_DATA_DIR" -o "$MYSQL_DATA_DIR" != "${clusterdir}${MYSQL_DATA_DIR_SUB}/db" ]; then
- nls "Error: datadir specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/db"
+ if [ -z "$MYSQL_DATA_DIR" -o "$MYSQL_DATA_DIR" != "$clusterdir/mysqldb/db" ]; then
+ nls "Error: datadir specified in %s should be %s" "$config_file" "$clusterdir/mysqldb/db"
nls " MariaDB can't be run."
exit 6
fi
- if [ -z "$MYSQL_PIDFILE" -o "$MYSQL_PIDFILE" != "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid" ]; then
- nls "Error: pid-file specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid"
+ if [ -z "$MYSQL_PIDFILE" -o "$MYSQL_PIDFILE" != "$clusterdir/mysqldb/mysql.pid" ]; then
+ nls "Error: pid-file specified in %s should be %s" "$config_file" "$clusterdir/mysqldb/mysql.pid"
nls " MariaDB can't be run."
exit 6
fi
@@ -253,7 +241,8 @@ mysqlstart() {
# SERVICE_LIMITS isn't applied automatically: mariadbd is started directly, not via daemon()
_daemon_set_ulimits
- TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \
+ # absolute nice level, as daemon() sets it; nice -n alone adds to the caller's level
+ TMPDIR=/tmp nice -n $((${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} - $(nice))) \
/usr/bin/setsid /usr/sbin/mariadbd \
--defaults-file=$MYSQL_CONFIG \
--datadir=$MYSQL_DATA_DIR \
@@ -340,12 +329,6 @@ mysqlsubsys() {
mysqlinit() {
clusterdir="$1"
- if [ -f /etc/mysqld.conf ]; then
- nls "Running in \`no cluster compat' mode: can't initialize database."
- nls "Move /etc/mysqld.conf away and rerun \`$0 init' (new config will be in $clusterdir)."
- exit 1
- fi
-
if [ -f "$clusterdir/mysqld.conf" ]; then
mysqlgetconfig "$clusterdir"
else
@@ -398,8 +381,8 @@ mysqlinit() {
cat > $MYSQL_DATA_DIR/mariadb-init.sql <<-EOF
CREATE DATABASE mysql;
use mysql;
- $(cat /usr/share/mariadb/mysql_system_tables.sql)
- $(sed -e "/@current_hostname/d" /usr/share/mariadb/mysql_system_tables_data.sql)
+ $(cat /usr/share/mariadb/mariadb_system_tables.sql)
+ $(sed -e "/@current_hostname/d" /usr/share/mariadb/mariadb_system_tables_data.sql)
EOF
ok=0
@@ -471,7 +454,7 @@ shell> mysql -u mysql mysql
mysql> show tables
Try 'mariadbd --help' if you have problems with paths. Setting on
-logging in /etc/mysqld.conf gives you a log in /var/log/mariadb/log that
+logging in $MYSQL_CONFIG gives you a log in /var/log/mariadb/log that
may be helpful. The latest information about MariaDB is available on the
web at https://www.mariadb.org/.
diff --git a/mysql-clusters.conf b/mysql-clusters.conf
index c617647..fb841f8 100644
--- a/mysql-clusters.conf
+++ b/mysql-clusters.conf
@@ -5,6 +5,6 @@
#
# You can add one cluster per line
# /config/location.conf=/cluster/directory
-# If you give config name without path it defaults to /etc/mysql/
+# If you give config name without path it defaults to /etc/mariadb/
-mysqld.conf=/var/lib/mysql
+mysqld.conf=/var/lib/mariadb
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mariadb.git/commitdiff/ddf186992123fe5ce03fd5ee6bac87a541bc8a02
More information about the pld-cvs-commit
mailing list