Fix use of scriplets.

1. chkconfig --add is always unconditional.
2. condrestart goes in %postun, not %post (fixes script errors in the
    installer)
http://fedoraproject.org/wiki/ScriptletSnippets for more information.
This commit is contained in:
Bill Nottingham 2006-03-08 20:56:44 +00:00
parent 4d83a353c3
commit 08986bc647

View File

@ -4,7 +4,7 @@
%endif
Name: avahi
Version: 0.6.9
Release: 1
Release: 2
Summary: Local network service discovery
Group: System Environment/Base
License: LGPL
@ -198,35 +198,22 @@ rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
if [ "$1" -eq 1 ]; then
if ! /sbin/chkconfig --list avahi-daemon >/dev/null 2>&1 ; then
# if user has not configured avahi service at all
/sbin/chkconfig --add avahi-daemon >/dev/null 2>&1
fi;
if ! /sbin/chkconfig --list avahi-dnsconfd >/dev/null 2>&1 ; then
# avahi-dnsconfd NOT run by default in any runlevel; add it
# so system-config-services can see it
/sbin/chkconfig --add avahi-dnsconfd >/dev/null 2>&1
fi;
if [ "$1" -eq 1 ]; then
# We should realy make dbus reload the system.d config here. Dunno how though.
# kill -HUP `cat /var/run/messagebus.pid` ?
if [ -s /etc/localtime ]; then
cp -fp /etc/localtime /etc/avahi/etc/localtime || :;
fi;
elif [ "$1" -gt 1 ]; then
if ! /sbin/chkconfig --list avahi-daemon >/dev/null 2>&1 ; then
# if user has not configured avahi service at all
# reset initscript run order:
LC_ALL=C /sbin/chkconfig --levels=0123456 avahi-daemon reset >/dev/null 2>&1
fi;
# pre 0.5.2-3, avahi-daemon initscript had 'chkconfig: 345 34 66',
# so it got started AFTER messagebus ( 97 ) and was unable to start.
# It now has 'chkconfig: 345 98 02'.
fi
%postun
/sbin/ldconfig
if [ "$1" -ge "1" ]; then
/sbin/service avahi-daemon condrestart >/dev/null 2>&1
/sbin/service avahi-dnsconfd condrestart >/dev/null 2>&1
fi;
%postun -p /sbin/ldconfig
fi
%preun
if [ "$1" -eq 0 ]; then