forked from pool/mariadb
Accepting request 783079 from home:kukuk:container
- Cleanup mysql user creation/handling and use sysusers.d OBS-URL: https://build.opensuse.org/request/show/783079 OBS-URL: https://build.opensuse.org/package/show/server:database/mariadb?expand=0&rev=249
This commit is contained in:
parent
4548e141d6
commit
ebf7225232
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Feb 26 16:25:55 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>
|
||||||
|
|
||||||
|
- Cleanup mysql user creation/handling and use sysusers.d
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Feb 25 19:40:40 UTC 2020 - Andreas Schwab <schwab@suse.de>
|
Tue Feb 25 19:40:40 UTC 2020 - Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
34
mariadb.spec
34
mariadb.spec
@ -68,6 +68,7 @@ Source2: %{name}.keyring
|
|||||||
Source4: README.debug
|
Source4: README.debug
|
||||||
Source5: suse-test-run
|
Source5: suse-test-run
|
||||||
Source7: README.install
|
Source7: README.install
|
||||||
|
Source12: mysql-user.conf
|
||||||
Source14: my.ini
|
Source14: my.ini
|
||||||
Source15: mariadb.service
|
Source15: mariadb.service
|
||||||
Source16: mariadb.target
|
Source16: mariadb.target
|
||||||
@ -114,7 +115,6 @@ BuildRequires: pkgconfig
|
|||||||
BuildRequires: procps
|
BuildRequires: procps
|
||||||
# Some tests and myrocks_hotbackup script need python3
|
# Some tests and myrocks_hotbackup script need python3
|
||||||
BuildRequires: python3
|
BuildRequires: python3
|
||||||
BuildRequires: shadow
|
|
||||||
BuildRequires: sqlite
|
BuildRequires: sqlite
|
||||||
BuildRequires: tcpd-devel
|
BuildRequires: tcpd-devel
|
||||||
# Tests requires time and ps and some perl modules
|
# Tests requires time and ps and some perl modules
|
||||||
@ -137,6 +137,12 @@ BuildRequires: perl(Test::More)
|
|||||||
BuildRequires: perl(Time::HiRes)
|
BuildRequires: perl(Time::HiRes)
|
||||||
# Do not ever switch away from BuildRequires: pkgconfig(libsystemd); BuildRequires systemd/systemd-devel causes build cycles
|
# Do not ever switch away from BuildRequires: pkgconfig(libsystemd); BuildRequires systemd/systemd-devel causes build cycles
|
||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
|
BuildRequires: sysuser-shadow
|
||||||
|
BuildRequires: sysuser-tools
|
||||||
|
# Require mysql user
|
||||||
|
Requires(pre): user(mysql)
|
||||||
|
Requires: user(mysql)
|
||||||
|
#!BuildIgnore: user(mysql)
|
||||||
# Required by rcmysql
|
# Required by rcmysql
|
||||||
Requires: %{name}-client
|
Requires: %{name}-client
|
||||||
Requires: %{name}-errormessages = %{version}
|
Requires: %{name}-errormessages = %{version}
|
||||||
@ -147,7 +153,6 @@ Requires: perl-base
|
|||||||
# myrocks_hotbackup needs MySQLdb - if we want to use it under python3, we need python3-mysqlclient
|
# myrocks_hotbackup needs MySQLdb - if we want to use it under python3, we need python3-mysqlclient
|
||||||
Requires: python3-mysqlclient
|
Requires: python3-mysqlclient
|
||||||
Requires(post): permissions
|
Requires(post): permissions
|
||||||
Requires(pre): shadow
|
|
||||||
Recommends: logrotate
|
Recommends: logrotate
|
||||||
Conflicts: mariadb-server
|
Conflicts: mariadb-server
|
||||||
Conflicts: mysql
|
Conflicts: mysql
|
||||||
@ -234,10 +239,10 @@ Group: Productivity/Databases/Clients
|
|||||||
Requires: %{name}-errormessages = %{version}
|
Requires: %{name}-errormessages = %{version}
|
||||||
# Explicit requires to pull in charsets for errormessages
|
# Explicit requires to pull in charsets for errormessages
|
||||||
Requires: libmariadb3 >= 3.0
|
Requires: libmariadb3 >= 3.0
|
||||||
Requires(pre): shadow
|
|
||||||
Conflicts: mysql-client
|
Conflicts: mysql-client
|
||||||
Provides: mysql-client = %{version}
|
Provides: mysql-client = %{version}
|
||||||
Obsoletes: mysql-client < %{version}
|
Obsoletes: mysql-client < %{version}
|
||||||
|
%sysusers_requires
|
||||||
|
|
||||||
%description client
|
%description client
|
||||||
This package contains the standard clients for MariaDB.
|
This package contains the standard clients for MariaDB.
|
||||||
@ -470,6 +475,8 @@ export CXXFLAGS="$CFLAGS -felide-constructors"
|
|||||||
-Wno-dev "$@" ..
|
-Wno-dev "$@" ..
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
nm --numeric-sort sql/mysqld > sql/mysqld.sym
|
nm --numeric-sort sql/mysqld > sql/mysqld.sym
|
||||||
|
cd ..
|
||||||
|
%sysusers_generate_pre %{SOURCE12} mysql
|
||||||
|
|
||||||
%install
|
%install
|
||||||
# Helper function to generate filelist for binaries and their manpages
|
# Helper function to generate filelist for binaries and their manpages
|
||||||
@ -690,6 +697,10 @@ mkdir -p %{buildroot}/%{_lib}/security
|
|||||||
mv %{buildroot}/lib/security/pam_user_map.so %{buildroot}/%{_lib}/security/
|
mv %{buildroot}/lib/security/pam_user_map.so %{buildroot}/%{_lib}/security/
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# Install sysusers.d file
|
||||||
|
mkdir -p %{buildroot}%{_sysusersdir}
|
||||||
|
install -m 644 %{SOURCE12} %{buildroot}%{_sysusersdir}/
|
||||||
|
|
||||||
%check
|
%check
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
@ -719,23 +730,9 @@ cd mysql-test
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
# client does not require server and needs the user too
|
# client does not require server and needs the user too
|
||||||
%pre client
|
%pre client -f mysql.pre
|
||||||
getent group mysql >/dev/null || groupadd -r mysql
|
|
||||||
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
|
|
||||||
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
|
|
||||||
# if mysql user is not in mysql group or if mysql user doesn't have '/bin/false' shell set, do so
|
|
||||||
id -Gn mysql | grep '\bmysql\b' &>/dev/null || usermod -g mysql mysql
|
|
||||||
getent passwd mysql | cut -d: -f7 | grep '\b/bin/false\b' &>/dev/null || usermod -s /bin/false mysql
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
getent group mysql >/dev/null || groupadd -r mysql
|
|
||||||
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
|
|
||||||
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
|
|
||||||
# if mysql user is not in mysql group or if mysql user doesn't have '/bin/false' shell set, do so
|
|
||||||
id -Gn mysql | grep '\bmysql\b' &>/dev/null || usermod -g mysql mysql
|
|
||||||
getent passwd mysql | cut -d: -f7 | grep '\b/bin/false\b' &>/dev/null || usermod -s /bin/false mysql
|
|
||||||
|
|
||||||
%service_add_pre mariadb.service
|
%service_add_pre mariadb.service
|
||||||
|
|
||||||
%post
|
%post
|
||||||
@ -893,6 +890,7 @@ exit 0
|
|||||||
%dir %{_libdir}/mysql
|
%dir %{_libdir}/mysql
|
||||||
%dir %{_libdir}/mysql/plugin
|
%dir %{_libdir}/mysql/plugin
|
||||||
%{_libdir}/mysql/plugin/dialog_examples.so
|
%{_libdir}/mysql/plugin/dialog_examples.so
|
||||||
|
%{_sysusersdir}/mysql-user.conf
|
||||||
|
|
||||||
%files galera -f mariadb-galera.files
|
%files galera -f mariadb-galera.files
|
||||||
%doc Docs/README.wsrep
|
%doc Docs/README.wsrep
|
||||||
|
2
mysql-user.conf
Normal file
2
mysql-user.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Type Name ID GECOS [HOME]
|
||||||
|
u mysql 60 "MySQL database admin" /var/lib/mysql
|
Loading…
Reference in New Issue
Block a user