[nss-pam-ldapd] use %%{_unitdir} and new systemd macros
Nalin Dahyabhai
nalin at fedoraproject.org
Fri Jan 18 20:30:48 UTC 2013
commit 5cded00af86755377bfcc59baf4dc9aa3cb6d368
Author: Nalin Dahyabhai <nalin at redhat.com>
Date: Fri Jan 18 15:28:43 2013 -0500
use %%{_unitdir} and new systemd macros
- when deciding where to put systemd configuration, based
on patch from Václav Pavlín (#850232)
- use new systemd macros for scriptlet hooks, when available, based on
patch from Václav Pavlín (#850232)
nss-pam-ldapd.spec | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/nss-pam-ldapd.spec b/nss-pam-ldapd.spec
index acc29a7..d658d05 100644
--- a/nss-pam-ldapd.spec
+++ b/nss-pam-ldapd.spec
@@ -6,6 +6,14 @@
%global sysvinit 1
%endif
+# Fedora had these in F18, but we didn't cut over to use them until after F18
+# was frozen, so pretend it didn't happen until F19.
+%if 0%{?fedora} > 18 || 0%{?rhel} > 6
+%global systemd_macros 1
+%else
+%global systemd_macros 0
+%endif
+
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%global tmpfiles 1
%else
@@ -105,12 +113,12 @@ make check
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/{%{_initddir},%{_libdir},lib/systemd/system}
+mkdir -p $RPM_BUILD_ROOT/{%{_initddir},%{_libdir},%{_unitdir}}
%if %{sysvinit}
install -p -m755 %{SOURCE2} $RPM_BUILD_ROOT/%{_initddir}/nslcd
%endif
%if %{systemd}
-install -p -m755 %{SOURCE4} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_unitdir}/
%endif
%if 0%{?fedora} > 13 || 0%{?rhel} > 5
@@ -161,7 +169,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) %{_initddir}/nslcd
%endif
%if %{systemd}
-%config(noreplace) /lib/systemd/system/*
+%config(noreplace) %{_unitdir}/*
%endif
%attr(0755,nslcd,root) /var/run/nslcd
%if 0%{?fedora} > 13 || 0%{?rhel} > 5
@@ -184,8 +192,12 @@ getent passwd nslcd > /dev/null || \
/sbin/chkconfig --add nslcd
%endif
%if %{systemd}
+%if %{systemd_macros}
+%systemd_post nslcd.service
+%else
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%endif
+%endif
/sbin/ldconfig
# Import important non-default settings from nss_ldap or pam_ldap configuration
# files, but only the first time this package is installed.
@@ -266,9 +278,13 @@ if [ "$1" -eq "0" ]; then
/sbin/chkconfig --del nslcd
%endif
%if %{systemd}
+%if %{systemd_macros}
+%systemd_preun nslcd.service
+%else
/bin/systemctl --no-reload disable nslcd.service > /dev/null 2>&1 || :
/bin/systemctl stop nslcd.service > /dev/null 2>&1 || :
%endif
+%endif
fi
exit 0
@@ -280,11 +296,15 @@ if [ "$1" -ge "1" ]; then
fi
%endif
%if %{systemd}
+%if %{systemd_macros}
+%systemd_postun_with_restart nslcd.service
+%else
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ "$1" -ge "1" ]; then
/bin/systemctl try-restart nslcd.service >/dev/null 2>&1
fi
%endif
+%endif
exit 0
%if %{systemd}
@@ -308,6 +328,10 @@ exit 0
to make sure that nslcd is started after them if they're to be started
on the local system (#832706)
- alter the versioned Obsoletes: on pam_ldap to include the F18 package
+- use %%{_unitdir} when deciding where to put systemd configuration, based
+ on patch from Václav Pavlín (#850232)
+- use new systemd macros for scriptlet hooks, when available, based on
+ patch from Václav Pavlín (#850232)
* Sun Sep 09 2012 Jakub Hrozek <jhrozek at redhat.com> 0.7.17-1
- new upstream release 0.7.17
More information about the scm-commits
mailing list