Use config-based creation of users by systemd-sysusers, get rid of rpm-helper

This commit is contained in:
Mikhail Novosyolov 2021-02-12 23:15:39 +03:00
parent 43b012b17c
commit fc1d5fbe04
2 changed files with 13 additions and 2 deletions

3
mariadb-sysusers.conf Normal file
View file

@ -0,0 +1,3 @@
u @muser@ - "MySQL DB server" /srv/mysql
g @muser@ -
m @muser@ @muser@

View file

@ -27,6 +27,7 @@ Source0: https://downloads.mariadb.com/MariaDB/mariadb-%{version}/source/mariadb
Source100: mysqld.service
Source101: mysqld-prepare-db-dir
Source102: mysqld-wait-ready
Source103: mariadb-sysusers.conf
Source1000: %{name}.rpmlintrc
BuildRequires: bison
BuildRequires: cmake
@ -307,14 +308,17 @@ Obsoletes: mysql-server < 5.7
Provides: mysql-server = %{EVRD}
# for the script mysqld_safe
Requires: hostname
Requires(post,preun): rpm-helper
Requires(pre): /bin/systemd-sysusers
%description server
The MariaDB server. For a full MariaDB database server, install
package '%{name}'.
%pre server
%_pre_useradd %{muser} /srv/mysql /sbin/nologin
# https://nixtux.ru/1002
%{expand:
%(echo '%{sysusers_create_package %{name} %{SOURCE103}}' | sed -e 's,@muser@,%{muser},g')
}
%post server
%systemd_post mysqld.service
@ -375,6 +379,7 @@ package '%{name}'.
%{_bindir}/wsrep_*
%{_sbindir}/mysqld
%{_unitdir}/mysqld.service
%{_sysusersdir}/%{name}.conf
%{_sbindir}/mysqld-prepare-db-dir
%{_bindir}/mysqld-wait-ready
%doc %{_docdir}/%{name}-%{version}
@ -615,3 +620,6 @@ rm -f %{buildroot}%{_datadir}/groonga-normalizer-mysql/README.md \
%{buildroot}%{_datadir}/groonga/README.md \
%{buildroot}%{_datadir}/mysql/mroonga/AUTHORS \
%{buildroot}%{_datadir}/mysql/mroonga/COPYING
mkdir -p %{buildroot}%{_sysusersdir}
cat %{SOURCE1033} | sed -e 's,@muser@,%{muser},g' > %{buildroot}%{_sysusersdir}/%{name}.conf