diff --git a/nginx.spec b/nginx.spec index 6f6ec06..a067ec7 100644 --- a/nginx.spec +++ b/nginx.spec @@ -85,6 +85,7 @@ Source15: macros.nginxmods.in Source16: nginxmods.attr Source17: nginx-ssl-pass-dialog Source18: nginx@.service +Source19: nginx.sysusers Source102: nginx-logo.png Source200: README.dynamic Source210: UPGRADE-NOTES-1.6-to-1.10 @@ -142,9 +143,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} @@ -184,7 +185,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 @@ -488,13 +489,11 @@ mkdir -p $RPM_BUILD_ROOT%{_libexecdir} install -m755 $RPM_SOURCE_DIR/nginx-ssl-pass-dialog \ $RPM_BUILD_ROOT%{_libexecdir}/nginx-ssl-pass-dialog +# install sysusers file +install -p -D -m 0644 %{SOURCE19} %{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 %{SOURCE19} %post %systemd_post nginx.service @@ -597,6 +596,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 diff --git a/nginx.sysusers b/nginx.sysusers new file mode 100644 index 0000000..7f08e39 --- /dev/null +++ b/nginx.sysusers @@ -0,0 +1,3 @@ +#Type Name ID GECOS Home directory Shell +g nginx - +u nginx - "Nginx web server" /var/lib/nginx /sbin/nologin