From 92fafee5c7df077c5fe70a50c7f657e1800051df Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sun, 25 May 2025 01:26:24 +0800 Subject: [PATCH] fix systemd user creation --- mysql.spec | 25 +++++++++++++++---------- mysql.sysusers.conf | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 mysql.sysusers.conf diff --git a/mysql.spec b/mysql.spec index fcae34a..4fc678e 100644 --- a/mysql.spec +++ b/mysql.spec @@ -41,7 +41,7 @@ %global sameevr %{?epoch:%{epoch}:}%{version}-%{release} Name: mysql Version: 8.4.5 -Release: 1 +Release: 2 Summary: MySQL client programs and shared libraries URL: http://www.mysql.com License: GPL-2.0-or-later AND LGPL-2.1-only AND BSL-1.0 AND BSD-2-Clause @@ -53,6 +53,7 @@ Source7: README.mysql-license Source10: mysql.tmpfiles.d.in Source11: mysql.service.in Source12: mysql-prepare-db-dir.sh +Source13: mysql.sysusers.conf Source14: mysql-check-socket.sh Source15: mysql-scripts-common.sh Source17: mysql-wait-stop.sh @@ -77,7 +78,7 @@ BuildRequires: lz4-devel mecab-devel bison libzstd-devel libudev-devel %ifnarch aarch64 %{arm} s390 s390x BuildRequires: numactl-devel %endif -BuildRequires: openssl openssl-devel libcurl-devel make +BuildRequires: openssl openssl-devel libcurl-devel ninja-build BuildRequires: perl-interpreter perl-generators BuildRequires: rpcgen libtirpc-devel BuildRequires: protobuf-lite-devel rapidjson-devel zlib zlib-devel multilib-rpm-config procps @@ -164,9 +165,9 @@ Requires: %{name}-common%{?_isa} = %{sameevr} %{name}-config%{?_isa} Requires: %{name}-errmsg%{?_isa} = %{sameevr} %{?mecab:Requires: mecab-ipadic} Requires: coreutils -Requires(pre): /usr/sbin/useradd Requires: systemd -%{?systemd_requires: %systemd_requires} +%{?sysusers_requires_compat} +%{?systemd_requires} Recommends: libcap Requires(post): policycoreutils-python-utils %if %require_mysql_selinux @@ -315,7 +316,9 @@ cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ exit 1 fi %endif + %cmake \ + -G Ninja \ -DBUILD_CONFIG=mysql_release \ -DINSTALL_LAYOUT=RPM \ -DDAEMON_NAME="%{daemon_name}" \ @@ -367,8 +370,6 @@ cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ %{?with_debug: -DWITH_DEBUG=1} \ %{?with_debug: -DMYSQL_MAINTAINER_MODE=0} \ -DTMPDIR=/var/tmp \ - -DCMAKE_C_LINK_FLAGS="%{build_ldflags}" \ - -DCMAKE_CXX_LINK_FLAGS="%{build_ldflags}" \ -DCMAKE_SKIP_INSTALL_RPATH=YES \ -DWITH_UNIT_TESTS=0 %cmake -LAH @@ -398,10 +399,7 @@ rm -r %{buildroot}%{_tmpfilesdir}/mysql.conf # Create a sysusers.d config file # We no longer enforce the hardcoded UID/GID 27 -mkdir -p %{buildroot}%{_sysusersdir} -cat > %{buildroot}%{_sysusersdir}/%{name}.conf << EOF -u mysql - 'MariaDB and MySQL Server' %{dbdatadir} - -EOF +install -m0644 -D %{S:13} %{buildroot}%{_sysusersdir}/%{name}.conf install -D -p -m 755 %{__cmake_builddir}/scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir install -p -m 755 %{__cmake_builddir}/scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop @@ -455,6 +453,9 @@ rm -r var $(readlink var) cd - %endif +%pre server +%sysusers_create_compat %{S:13} + %post server %systemd_post %{daemon_name}.service if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then @@ -741,6 +742,10 @@ fi %{_libdir}/mysql/plugin/udf_example.so %changelog +* Sun May 25 2025 Funda Wang - 8.4.5-2 +- fix systemd user creation +- faster build with ninja + * Fri May 16 2025 wangkai <13474090681@163.com> - 8.4.5-1 - Update to 8.4.5 diff --git a/mysql.sysusers.conf b/mysql.sysusers.conf new file mode 100644 index 0000000..15965a4 --- /dev/null +++ b/mysql.sysusers.conf @@ -0,0 +1 @@ +u mysql - 'MariaDB and MySQL Server' /var/lib/mysql - -- Gitee