[ipmiutil] added F18 systemd macros for bug#850163

arcress arcress at fedoraproject.org
Tue Aug 21 15:32:14 UTC 2012


commit 15a2866b0cf3569e1e66038b4507c08aedaad9d2
Author: Andy Cress <arcress at users.sourceforge.net>
Date:   Tue Aug 21 11:30:43 2012 -0400

    added F18 systemd macros for bug#850163

 ipmiutil.spec |   52 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/ipmiutil.spec b/ipmiutil.spec
index 73406b3..8e6ee37 100644
--- a/ipmiutil.spec
+++ b/ipmiutil.spec
@@ -4,7 +4,7 @@
 #
 Name:      ipmiutil
 Version: 2.8.5
-Release:   1%{?dist}
+Release:   2%{?dist}
 Summary:   Easy-to-use IPMI server management utilities
 License:   BSD
 Group:     System Environment/Base
@@ -143,12 +143,11 @@ then
    scr_dir=%{_datadir}/%{name}
 
    if [ -x /bin/systemctl ]; then
-      systemd_dir=%{_unitdir}
       echo "IINITDIR=%{init_dir}" >>%{_datadir}/%{name}/ipmiutil.env
-      cp -f ${scr_dir}/ipmiutil_evt.service ${systemd_dir}
-      cp -f ${scr_dir}/ipmiutil_asy.service ${systemd_dir}
-      cp -f ${scr_dir}/ipmiutil_wdt.service ${systemd_dir}
-      cp -f ${scr_dir}/ipmi_port.service    ${systemd_dir}
+      cp -f ${scr_dir}/ipmiutil_evt.service %{_unitdir}
+      cp -f ${scr_dir}/ipmiutil_asy.service %{_unitdir}
+      cp -f ${scr_dir}/ipmiutil_wdt.service %{_unitdir}
+      cp -f ${scr_dir}/ipmi_port.service    %{_unitdir}
       # systemctl enable ipmi_port.service >/dev/null 2>&1 || :
    else 
       cp -f ${scr_dir}/ipmiutil_wdt %{init_dir}
@@ -186,14 +185,25 @@ then
       fi
    fi
 fi
+%if 0%{?fedora} >= 18
+%systemd_post  ipmiutil_evt.service 
+%systemd_post  ipmiutil_asy.service 
+%systemd_post  ipmiutil_wdt.service
+%systemd_post  ipmi_port.service   
+%endif
 
 %preun
 # before uninstall,  $1 = 1 if rpm -U, $1 = 0 if rpm -e
 if [ "$1" = "0" ]
 then
    if [ -x /bin/systemctl ]; then
-     systemd_dir=%{_unitdir}
-     if [ -f ${systemd_dir}/ipmiutil_evt.service ]; then
+     if [ -f %{_unitdir}/ipmiutil_evt.service ]; then
+%if 0%{?fedora} >= 18
+%systemd_preun  ipmiutil_evt.service 
+%systemd_preun  ipmiutil_asy.service 
+%systemd_preun  ipmiutil_wdt.service
+%systemd_preun  ipmi_port.service   
+%else
         systemctl disable ipmi_port.service >/dev/null 2>&1 || :
         systemctl disable ipmiutil_evt.service >/dev/null 2>&1 || :
         systemctl disable ipmiutil_asy.service >/dev/null 2>&1 || :
@@ -202,10 +212,7 @@ then
         systemctl stop ipmiutil_asy.service >/dev/null 2>&1 || :
         systemctl stop ipmiutil_wdt.service >/dev/null 2>&1 || :
         systemctl stop ipmi_port.service    >/dev/null 2>&1 || :
-        rm -f ${systemd_dir}/ipmiutil_evt.service 
-        rm -f ${systemd_dir}/ipmiutil_asy.service 
-        rm -f ${systemd_dir}/ipmiutil_wdt.service 
-        rm -f ${systemd_dir}/ipmi_port.service    
+%endif
      fi
    else 
      if [ -x /sbin/service ]; then
@@ -220,10 +227,6 @@ then
         /sbin/chkconfig --del ipmiutil_asy >/dev/null 2>&1
         /sbin/chkconfig --del ipmiutil_evt >/dev/null 2>&1
      fi
-        rm -f %{init_dir}/ipmiutil_wdt 2>/dev/null
-        rm -f %{init_dir}/ipmiutil_asy 2>/dev/null
-        rm -f %{init_dir}/ipmiutil_evt 2>/dev/null
-        rm -f %{init_dir}/ipmi_port    2>/dev/null
    fi
    if [ -f %{_sysconfdir}/cron.daily/checksel ]; then
         rm -f %{_sysconfdir}/cron.daily/checksel
@@ -232,14 +235,31 @@ fi
 
 %postun
 if [ -x /bin/systemctl ]; then
+%if 0%{?fedora} >= 18
+%systemd_postun_with_restart  ipmi_port.service   
+%else
    systemctl daemon-reload  || :
    if [ $1 -ge 1 ] ; then
       # Package upgrade, not uninstall
       systemctl try-restart ipmi_port.service  || :
    fi
+%endif
+   if [ -f %{_unitdir}/ipmiutil_evt.service ]; then
+      rm -f %{_unitdir}/ipmiutil_evt.service 
+      rm -f %{_unitdir}/ipmiutil_asy.service 
+      rm -f %{_unitdir}/ipmiutil_wdt.service 
+      rm -f %{_unitdir}/ipmi_port.service    
+   fi
+else
+   rm -f %{init_dir}/ipmiutil_wdt 2>/dev/null
+   rm -f %{init_dir}/ipmiutil_asy 2>/dev/null
+   rm -f %{init_dir}/ipmiutil_evt 2>/dev/null
+   rm -f %{init_dir}/ipmi_port    2>/dev/null
 fi
 
 %changelog
+* Tue Aug 21 2012 Andrew Cress <arcress at users.sourceforge.net> 2.8.5-2
+  Added F18 systemd macros for RH bug #850163
 * Fri May 04 2012 Andrew Cress <arcress at users.sourceforge.net> 2.8.4-1
   Fixups for devel rpm (RH bug #818910)
 * Tue Apr 24 2012 Andrew Cress <arcress at users.sourceforge.net> 2.8.3-1


More information about the scm-commits mailing list