several minor fixes into spec file

This commit is contained in:
Igor Ippolitov 2019-04-11 17:50:37 +03:00
parent bbbde8d22b
commit 3704dc25ff
1 changed files with 11 additions and 7 deletions

View File

@ -33,8 +33,7 @@ install -d -m755 %buildroot/etc/default
install -m644 %name.default %buildroot/etc/default/%name
install -d -m755 %buildroot/etc/logrotate.d
install -m644 %name.logrotate %buildroot%_sysconfdir/logrotate.d/%name
mkdir -p %{buildroot}%{logdir}
touch %{buildroot}%{logdir}/daemon.log
install -d -m755 %{buildroot}%{logdir}
%files
%doc README.md nginx-ldap-auth.conf backend-sample-app.py LICENSE
@ -43,18 +42,23 @@ touch %{buildroot}%{logdir}/daemon.log
%_bindir/nginx-ldap-auth-daemon
%_unitdir/%name.service
%attr(750,nginx-ldap-auth,nginx-ldap-auth) %dir %{logdir}
%config %ghost %attr(640,nginx-ldap-auth,nginx-ldap-auth) %{logdir}/daemon.log
%post
%pre
getent group nginx-ldap-auth > /dev/null || groupadd -r nginx-ldap-auth
getent passwd nginx-ldap-auth > /dev/null || \
useradd -r -d /var/lib/nginx -g nginx-ldap-auth \
-s /sbin/nologin -c "Nginx auth helper" nginx-ldap-auth
/usr/bin/systemctl preset nginx-ldap-auth.service
%post
if [ $1 -eq 1 ]; then
/usr/bin/systemctl preset nginx-ldap-auth.service >/dev/null 2>&1 ||:
fi;
%preun
/usr/bin/systemctl --no-reload disable nginx-ldap-auth.service >/dev/null 2>&1 ||:
/usr/bin/systemctl stop nginx-ldap-auth.service >/dev/null 2>&1 ||:
if [ $1 -eq 0 ]; then
/usr/bin/systemctl --no-reload disable nginx-ldap-auth.service >/dev/null 2>&1 ||:
/usr/bin/systemctl stop nginx-ldap-auth.service >/dev/null 2>&1 ||:
fi;
%postun
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: