Switch from the RPM scriptlet to the sysusers.d configuration for 'mysql' user / group creation
See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers. --- My final decision is to be progressive and completely remove the old behaviour. --- My original strategy was to introduce these changes with full backward compatibility for older Fedora releases and hopefully also existing RHEL releases. However that didn't work as smoothly as I expected. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/F6DCB3KCTB3SEMQWLE7OITV3I4T24ZV6 Now I'm pressured by latest Rawhide change that strenghten the automatically generated user(), group() from 'Recommends:' to 'Requires:' https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/4CNWZ7HYSUO5TUDU7RHRFHPEWQENNYNI --- The MySQL upstream do not ship their own sysusers.d configuration file. WARNING: We no longer enforce the fixed UID/GID 27 !!! The fixed UID/GID 27 was also drooped from the Fedora static allocation list: https://src.fedoraproject.org/rpms/setup/c/df5ba7?branch=rawhide
This commit is contained in:
parent
947ab228f1
commit
646e37cc97
1 changed files with 14 additions and 7 deletions
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
Name: %{majorname}%{majorversion}
|
||||
Version: %{package_version}
|
||||
Release: 1%{?with_debug:.debug}%{?dist}
|
||||
Release: 2%{?with_debug:.debug}%{?dist}
|
||||
Summary: MySQL client programs and shared libraries
|
||||
URL: http://www.mysql.com
|
||||
|
||||
|
|
@ -388,7 +388,6 @@ Requires: %{_sysconfdir}/my.cnf.d
|
|||
Requires: %{pkgname}-errmsg = %{sameevr}
|
||||
%{?mecab:Requires: mecab-ipadic}
|
||||
Requires: coreutils
|
||||
Requires(pre): /usr/sbin/useradd
|
||||
# We require this to be present for %%{_tmpfilesdir}
|
||||
Requires: systemd
|
||||
# Make sure it's there when scriptlets run, too
|
||||
|
|
@ -646,6 +645,13 @@ install -D -p -m 644 %{_vpath_builddir}/scripts/mysql@.service %{buildroot}%{_un
|
|||
install -D -p -m 0644 %{_vpath_builddir}/scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{daemon_name}.conf
|
||||
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
|
||||
|
||||
# helper scripts for service starting
|
||||
install -D -p -m 755 %{_vpath_builddir}/scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
|
||||
install -p -m 755 %{_vpath_builddir}/scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop
|
||||
|
|
@ -783,11 +789,6 @@ popd
|
|||
|
||||
|
||||
|
||||
%pre -n %{pkgname}-server
|
||||
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
|
||||
/usr/sbin/useradd -M -N -g mysql -o -r -d %{dbdatadir} -s /sbin/nologin \
|
||||
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
|
||||
|
||||
%post -n %{pkgname}-server
|
||||
%systemd_post %{daemon_name}.service
|
||||
if [ ! -e "%{logfile}" -a ! -h "%{logfile}" ] ; then
|
||||
|
|
@ -979,6 +980,7 @@ fi
|
|||
%{_libexecdir}/mysql-scripts-common
|
||||
|
||||
%{_tmpfilesdir}/%{daemon_name}.conf
|
||||
%{_sysusersdir}/%{name}.conf
|
||||
%attr(0755,mysql,mysql) %dir %{dbdatadir}
|
||||
%attr(0750,mysql,mysql) %dir %{_localstatedir}/lib/mysql-files
|
||||
%attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring
|
||||
|
|
@ -1104,6 +1106,11 @@ fi
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Apr 06 2025 Michal Schorm <mschorm@redhat.com> - 8.0.41-2
|
||||
- Switch from the RPM scriptlet to the sysusers.d configuration
|
||||
for 'mysql' user / group creation
|
||||
- We no longer enforce the fixed UID/GID 27 !!!
|
||||
|
||||
* Fri Feb 28 2025 Michal Schorm <mschorm@redhat.com> - 8.0.41-1
|
||||
- Rebase to MySQL 8.0.41
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue