On
http://fedoraproject.org/wiki/PackagingGuidelines under "Running
scriptlets only in certain situations" it gives an example:
This means that for example a package that installs an init script
with the chkconfig command should uninstall it only on erase and not
upgrade with the following snippet:
%postun
if [ $1 -eq 0 ]; then
/sbin/chkconfig --del %{name}
fi
However, that example is incorrect. By the time %postun is run, the
/etc/init.d/%{name} file is already gone. This needs to be run
instead in %preun.