Fix (de-)installation scripts

Resolves: #507557
This commit is contained in:
Jan Šafránek 2009-06-29 13:49:48 +00:00
parent 6786f73792
commit 393bf4af08

View File

@ -3,9 +3,9 @@
#
%if %{?_with_debug:1}%{!?_with_debug:0}
Release: 1.debug%{?dist}
Release: 2.debug%{?dist}
%else
Release: 1%{?dist}
Release: 2%{?dist}
%endif
Name: freeipmi
@ -20,6 +20,11 @@ Patch3: freeipmi-0.6.4-argmax.patch
Patch4: freeipmi-0.6.4-pathsep.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libgcrypt-devel texinfo
Requires(pre): chkconfig
Requires(post): chkconfig
Requires(preun): chkconfig
# for /sbin/service
Requires(preun): initscripts
Requires(post): info
Requires(preun): info
# Necessary as only those archs implement iopl and friends (#368541)
@ -95,80 +100,42 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT
%post
if [ -x /sbin/install-info ]; then
#/sbin/install-info %{_infodir}/freeipmi.info.gz %{_infodir}/dir
/sbin/install-info %{_infodir}/freeipmi-faq.info.gz %{_infodir}/dir
fi
/sbin/install-info %{_infodir}/freeipmi-faq.info.gz %{_infodir}/dir || :
/sbin/ldconfig
%preun
if [ $1 = 0 ]; then
if [ -x /sbin/install-info ]; then
#/sbin/install-info --delete %{_infodir}/freeipmi.info.gz %{_infodir}/dir
/sbin/install-info --delete %{_infodir}/freeipmi-faq.info.gz %{_infodir}/dir
fi
/sbin/install-info --delete %{_infodir}/freeipmi-faq.info.gz %{_infodir}/dir || :
fi
%postun -p /sbin/ldconfig
%post bmc-watchdog
if [ "$1" = 1 ]; then
if [ -x %{_initrddir}/freeipmi-bmc-watchdog ]; then
/sbin/chkconfig --add freeipmi-bmc-watchdog
/sbin/chkconfig freeipmi-bmc-watchdog off
fi
fi
if [ $1 -ge 1 ]; then
if [ -x %{_initrddir}/freeipmi-bmc-watchdog ]; then
if %{_initrddir}/freeipmi-bmc-watchdog status | grep -q running; then
%{_initrddir}/freeipmi-bmc-watchdog restart
else
%{_initrddir}/freeipmi-bmc-watchdog condrestart
fi
fi
fi
/sbin/chkconfig --add freeipmi-bmc-watchdog
%preun bmc-watchdog
#
# Stop bmc-watchdog if it is running
#
if [ "$1" = 0 ]; then
if [ -x %{_initrddir}/freeipmi-bmc-watchdog ]; then
if %{_initrddir}/freeipmi-bmc-watchdog status | grep -q running; then
%{_initrddir}/freeipmi-bmc-watchdog stop
fi
/sbin/chkconfig --del freeipmi-bmc-watchdog
fi
/sbin/service freeipmi-bmc-watchdog stop >/dev/null 2>&1
/sbin/chkconfig --del freeipmi-bmc-watchdog
fi
%postun bmc-watchdog
if [ "$1" -ge "1" ] ; then
/sbin/service freeipmi-bmc-watchdog condrestart >/dev/null 2>&1 || :
fi
%post ipmidetectd
if [ "$1" = 1 ]; then
if [ -x %{_initrddir}/freeipmi-ipmidetectd ]; then
/sbin/chkconfig --add freeipmi-ipmidetectd
/sbin/chkconfig freeipmi-ipmidetectd off
fi
fi
if [ $1 -ge 1 ]; then
if [ -x %{_initrddir}/freeipmi-ipmidetectd ]; then
if %{_initrddir}/freeipmi-ipmidetectd status | grep -q running; then
%{_initrddir}/freeipmi-ipmidetectd restart
else
%{_initrddir}/freeipmi-ipmidetectd condrestart
fi
fi
fi
/sbin/chkconfig --add freeipmi-ipmidetectd
%preun ipmidetectd
#
# Stop ipmidetectd if it is running
#
if [ "$1" = 0 ]; then
if [ -x %{_initrddir}/freeipmi-ipmidetectd ]; then
if %{_initrddir}/freeipmi-ipmidetectd status | grep -q running; then
%{_initrddir}/freeipmi-ipmidetectd stop
fi
/sbin/chkconfig --del freeipmi-ipmidetectd
fi
/sbin/service freeipmi-ipmidetectd stop >/dev/null 2>&1
/sbin/chkconfig --del freeipmi-ipmidetectd
fi
%postun ipmidetectd
if [ "$1" -ge "1" ] ; then
/sbin/service/freeipmi-ipmidetectd condrestart >/dev/null 2>&1 || :
fi
%files
@ -328,6 +295,9 @@ fi
%{_mandir}/man8/ipmidetectd.8*
%changelog
* Mon Jun 29 2009 Jan Safranek <jsafrane@redhat.com> - 0.7.10-2
- Fix (de-)installation scripts
* Wed Jun 17 2009 Jan Safranek <jsafrane@redhat.com> - 0.7.10-1
- Update to freeipmi-0.7.10