diff options
-rw-r--r-- | redis.spec | 35 | ||||
-rw-r--r-- | redis.sysusers | 1 | ||||
-rw-r--r-- | redis.tmpfiles | 3 |
3 files changed, 38 insertions, 1 deletions
@@ -18,11 +18,17 @@ # Tests fail in mock, not in local build. %bcond_with tests +%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9 +%bcond_without sysusers +%else +%bcond_with sysusers +%endif + %global upstream_ver 8.0.3 Name: redis Version: %{upstream_ver} -Release: 3%{?dist} +Release: 4%{?dist} Summary: A persistent key-value database # redis: RSALv2 or SSPLv1 or AGPLv3 (only AGPLv3 is OSS) # hiredis: BSD-3-Clause @@ -36,6 +42,8 @@ Source0: https://github.com/redis/redis/archive/refs/tags/%{version}.t Source1: %{name}.logrotate Source2: %{name}-sentinel.service Source3: %{name}.service +Source4: %{name}.sysusers +Source5: %{name}.tmpfiles # Fix default paths in configuration files for RPM layout Patch0: %{name}-conf.patch @@ -61,7 +69,12 @@ Obsoletes: redis-trib < 8 Obsoletes: redis-doc < 8 Requires: logrotate +%if %{with sysusers} +%sysusers_requires_compat +BuildRequires: systemd-rpm-macros +%else Requires(pre): shadow-utils +%endif Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -184,6 +197,14 @@ make %{?_smp_mflags} %{make_flags} all %install make %{make_flags} install +%if %{with sysusers} +# System user +install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf +%endif + +# Install tmpfiles.d file +install -p -D -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf + # Filesystem. install -d %{buildroot}%{_sharedstatedir}/%{name} install -d %{buildroot}%{_localstatedir}/log/%{name} @@ -231,11 +252,15 @@ make %{make_flags} test-sentinel %endif %pre +%if %{with sysusers} +%sysusers_create_compat %{SOURCE4} +%else getent group %{name} &> /dev/null || \ groupadd -r %{name} &> /dev/null getent passwd %{name} &> /dev/null || \ useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \ -c 'Redis Database Server' %{name} &> /dev/null +%endif exit 0 %if 0%{?fedora} < 34 && 0%{?rhel} < 9 @@ -310,6 +335,10 @@ fi %dir %{_sysconfdir}/systemd/system/%{name}.service.d %dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d %dir %attr(0755, redis, redis) %ghost %{_localstatedir}/run/%{name} +%if %{with sysusers} +%{_sysusersdir}/%{name}.conf +%endif +%{_tmpfilesdir}/%{name}.conf %files devel %license LICENSE.txt @@ -318,6 +347,10 @@ fi %changelog +* Mon Jul 28 2025 Remi Collet <remi@remirepo.net> - 8.0.3-4 +- add sysusers.d file for user management +- add tmpfiles.d file for temporary dir management + * Wed Jul 23 2025 Remi Collet <remi@remirepo.net> - 8.0.3-3 - add /etc/redis/modules drop-in directory for module configuration files diff --git a/redis.sysusers b/redis.sysusers new file mode 100644 index 0000000..0494785 --- /dev/null +++ b/redis.sysusers @@ -0,0 +1 @@ +u redis - "Redis Database Server" /var/lib/redis /sbin/nologin diff --git a/redis.tmpfiles b/redis.tmpfiles new file mode 100644 index 0000000..cf43fcb --- /dev/null +++ b/redis.tmpfiles @@ -0,0 +1,3 @@ +D /run/redis 0755 redis redis - +d /var/lib/redis 0750 redis redis - +d /var/log/redis 0750 redis redis - |