I have a sample rpm spec file like
Name: helloworld
Version: 2.0
Release: 2%{?dist}
Summary: Simple Hello World rpm
License: Internal
Source0: helloworld-src.tar.bz2
%description
%prep
%setup -c -q -T -D -a 0
%build
%install
echo "Install command ..."
%post
echo "post command..."
%postun
echo "postun command..."
%files
%doc
%changelog
When I execute rpm -i helloworld.rpm
, the output is
post command...
But when I execute rpm --reinstall helloworld
, the output is
post command...
postun command...
Whys is this so? I was expecting postun
to be called before post
would be called.
Where can I find which scriplets will be called during rpm --reinstall
?
It's because reinstall is like an upgrade; the new one gets installed and the old one is uninstalled, triggering the %postun
. The full sequence, from Fedora's excellent packaging guidelines, shows you are hitting steps 4 and 11: