[samba4] Introduce new systemd-rpm macros for F18 and RHEL7.

asn asn at fedoraproject.org
Thu Aug 23 16:11:07 UTC 2012


commit 6d589ea1dde18e2f7aec3667a6d46d3d204feef2
Author: Andreas Schneider <asn at cryptomilk.org>
Date:   Thu Aug 23 17:42:49 2012 +0200

    Introduce new systemd-rpm macros for F18 and RHEL7.
    
    resolves: #850306

 samba4.spec |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 3 deletions(-)
---
diff --git a/samba4.spec b/samba4.spec
index d45d54d..d809b7a 100644
--- a/samba4.spec
+++ b/samba4.spec
@@ -1,4 +1,4 @@
-%define main_release 135
+%define main_release 136
 
 %define samba_version 4.0.0
 %define talloc_version 2.0.7
@@ -38,7 +38,7 @@
 %global with_ldb 0
 %endif
 
-%if 0%{?fedora} > 16
+%if 0%{?fedora} > 16 || 0%{?rhel} > 6
 %global with_usrmove 1
 %endif
 
@@ -592,10 +592,18 @@ fi
 exit 0
 %endif
 
+%if 0%{?fedora} == 17
 if [ $1 -eq 1 ] ; then
     # Initial installation
     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
+exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_post smb.service
+%systemd_post nmb.service
+%endif
 
 %preun
 %if 0%{?rhel} == 6
@@ -608,6 +616,7 @@ fi
 exit 0
 %endif
 
+%if 0%{?fedora} == 17
 if [ $1 -eq 0 ] ; then
     # Package removal, not upgrade
     /bin/systemctl --no-reload disable smb.service > /dev/null 2>&1 || :
@@ -615,15 +624,28 @@ if [ $1 -eq 0 ] ; then
     /bin/systemctl stop smb.service > /dev/null 2>&1 || :
     /bin/systemctl stop nmb.service > /dev/null 2>&1 || :
 fi
+exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_preun smb.service
+%systemd_preun nmb.service
+%endif
 
 %postun
-%if 0%{?fedora} > 15 || 0%{?rhel} > 6
+%if 0%{?fedora} == 17
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
     /bin/systemctl try-restart smb.service >/dev/null 2>&1 || :
     /bin/systemctl try-restart nmb.service >/dev/null 2>&1 || :
 fi
+exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_postun_with_restart smb.service
+%systemd_postun_with_restart nmb.service
 %endif
 
 %post libs -p /sbin/ldconfig
@@ -652,9 +674,16 @@ fi
 exit 0
 %endif
 
+%if 0%{?fedora} == 17
 if [ "$1" -ge "1" ]; then
     /bin/systemctl try-restart winbind.service >/dev/null 2>&1 || :
 fi
+exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_post winbind.service
+%endif
 
 %preun winbind
 %if 0%{?rhel} == 6
@@ -665,11 +694,33 @@ fi
 exit 0
 %endif
 
+%if 0%{?fedora} == 17
 if [ $1 = 0 ] ; then
     /bin/systemctl stop winbind.service >/dev/null 2>&1 || :
     /bin/systemctl disable winbind.service
 fi
 exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_preun winbind.service
+%endif
+
+%postun winbind
+%if 0%{?fedora} == 17
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart smb.service >/dev/null 2>&1 || :
+    /bin/systemctl try-restart nmb.service >/dev/null 2>&1 || :
+fi
+exit 0
+%endif
+
+%if 0%{?fedora} > 17 || 0%{?rhel} > 6
+%systemd_postun_with_restart smb.service
+%systemd_postun_with_restart nmb.service
+%endif
 
 %post common
 /sbin/ldconfig
@@ -1306,6 +1357,10 @@ rm -rf %{buildroot}
 %endif # with_libwbclient
 
 %changelog
+* Thu Aug 23 2012 - Andreas Schneider <asn at redhat.com>
+- Introduce new systemd-rpm macros for F18 and RHEL7.
+- resolves: #850306
+
 * Tue Aug 21 2012 - Sumit Bose <sbose at redhat.com> - 2:4.0.0-135.beta6
 - Fix Epoch related issue in RHEL builds.
 


More information about the scm-commits mailing list