Use systemd-sysusers
Resolves: RHEL-77486 - [RFE] nginx use systemd-sysusers
This commit is contained in:
parent
27c12133bd
commit
ae74f4cfd8
24
nginx.spec
24
nginx.spec
@ -41,7 +41,7 @@
|
||||
Name: nginx
|
||||
Epoch: 2
|
||||
Version: 1.20.1
|
||||
Release: 20%{?dist}
|
||||
Release: 21%{?dist}
|
||||
|
||||
Summary: A high performance web server and reverse proxy server
|
||||
# BSD License (two clause)
|
||||
@ -62,6 +62,7 @@ Source13: nginx-upgrade
|
||||
Source14: nginx-upgrade.8
|
||||
Source15: macros.nginxmods.in
|
||||
Source16: nginxmods.attr
|
||||
Source17: nginx.sysusers
|
||||
Source102: nginx-logo.png
|
||||
Source103: 404.html
|
||||
Source104: 50x.html
|
||||
@ -134,9 +135,9 @@ Recommends: logrotate
|
||||
Requires: %{name}-core = %{epoch}:%{version}-%{release}
|
||||
|
||||
BuildRequires: systemd
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%{?systemd_requires}
|
||||
|
||||
# For external nginx modules
|
||||
Provides: nginx(abi) = %{nginx_abiversion}
|
||||
|
||||
@ -176,7 +177,7 @@ Meta package that installs all available nginx modules.
|
||||
%package filesystem
|
||||
Summary: The basic directory layout for the Nginx server
|
||||
BuildArch: noarch
|
||||
Requires(pre): shadow-utils
|
||||
%{?sysusers_requires_compat}
|
||||
|
||||
%description filesystem
|
||||
The nginx-filesystem package contains the basic directory layout
|
||||
@ -466,14 +467,11 @@ sed -e "s|@@NGINX_ABIVERSION@@|%{nginx_abiversion}|g" \
|
||||
## Install dependency generator
|
||||
install -Dpm0644 -t %{buildroot}%{_fileattrsdir} %{SOURCE16}
|
||||
|
||||
|
||||
# install sysusers file
|
||||
install -p -D -m 0644 %{SOURCE17} %{buildroot}%{_sysusersdir}/nginx.conf
|
||||
|
||||
%pre filesystem
|
||||
getent group %{nginx_user} > /dev/null || groupadd -r %{nginx_user}
|
||||
getent passwd %{nginx_user} > /dev/null || \
|
||||
useradd -r -d %{_localstatedir}/lib/nginx -g %{nginx_user} \
|
||||
-s /sbin/nologin -c "Nginx web server" %{nginx_user}
|
||||
exit 0
|
||||
%sysusers_create_compat %{SOURCE17}
|
||||
|
||||
%post
|
||||
%systemd_post nginx.service
|
||||
@ -574,6 +572,7 @@ fi
|
||||
%dir %{_sysconfdir}/nginx/default.d
|
||||
%dir %{_sysconfdir}/systemd/system/nginx.service.d
|
||||
%dir %{_unitdir}/nginx.service.d
|
||||
%{_sysusersdir}/nginx.conf
|
||||
|
||||
%if %{with geoip}
|
||||
%files mod-http-geoip
|
||||
@ -611,6 +610,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Feb 05 2025 Luboš Uhliarik <luhliari@redhat.com> - 2:1.20.1-21
|
||||
- Resolves: RHEL-77486 - [RFE] nginx use systemd-sysusers
|
||||
|
||||
* Mon Jul 15 2024 Luboš Uhliarik <luhliari@redhat.com> - 2:1.20.1-20
|
||||
- Resolves: RHEL-40075 - nginx worker processes memory leak
|
||||
|
||||
|
3
nginx.sysusers
Normal file
3
nginx.sysusers
Normal file
@ -0,0 +1,3 @@
|
||||
#Type Name ID GECOS Home directory Shell
|
||||
g nginx -
|
||||
u nginx - "Nginx web server" /var/lib/nginx /sbin/nologin
|
Loading…
Reference in New Issue
Block a user