get rid of posttrans - move update code to post

This commit is contained in:
Rich Megginson 2012-03-21 08:40:33 -06:00
parent c9ac9176bd
commit 5e3fefbf76

View File

@ -20,7 +20,7 @@
Summary: 389 Directory Server (base)
Name: 389-ds-base
Version: 1.2.10.4
Release: %{?relprefix}1%{?prerel}%{?dist}
Release: %{?relprefix}2%{?prerel}%{?dist}
License: GPLv2 with exceptions
URL: http://port389.org/
Group: System Environment/Daemons
@ -196,25 +196,12 @@ sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/%{pkgna
rm -rf $RPM_BUILD_ROOT
%post
# reload to pick up any changes to systemd files
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
# reload to pick up any shared lib changes
/sbin/ldconfig
%preun
if [ $1 -eq 0 ]; then # Final removal
# Package removal, not upgrade
/bin/systemctl --no-reload disable %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
/bin/systemctl stop %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
# remove instance specific service files/links
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
fi
%postun
/sbin/ldconfig
if [ $1 = 0 ]; then # Final removal
rm -rf /var/run/%{pkgname}
fi
%posttrans
# restart the snmp subagent if needed
/bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || :
# find all instances
instances="" # instances that require a restart after upgrade
ninst=0 # number of instances found in total
@ -252,10 +239,23 @@ for inst in $instances ; do
echo restarting instance $inst > $output 2>&1 || :
/bin/systemctl start $inst > $output 2>&1 || :
done
# restart the snmp subagent if needed
/bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || :
exit 0
%preun
if [ $1 -eq 0 ]; then # Final removal
# Package removal, not upgrade
/bin/systemctl --no-reload disable %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
/bin/systemctl stop %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
# remove instance specific service files/links
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
fi
%postun
/sbin/ldconfig
if [ $1 = 0 ]; then # Final removal
rm -rf /var/run/%{pkgname}
fi
%files
%defattr(-,root,root,-)
%doc LICENSE EXCEPTION LICENSE.GPLv2
@ -298,6 +298,9 @@ exit 0
%{_libdir}/%{pkgname}/libslapd.so.*
%changelog
* Wed Mar 21 2012 Rich Megginson <rmeggins@redhat.com> - 1.2.10.4-2
- get rid of posttrans - move update code to post
* Tue Mar 13 2012 Rich Megginson <rmeggins@redhat.com> - 1.2.10.4-1
- Ticket #305 - Certain CMP operations hang or cause ns-slapd to crash