Issue
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
?
Solution
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:
- %pretrans of new package
- %pre of new package
- (package install)
- %post of new package
- %triggerin of other packages (set off by installing new package)
- %triggerin of new package (if any are true)
- %triggerun of old package (if it’s set off by uninstalling the old package)
- %triggerun of other packages (set off by uninstalling old package)
- %preun of old package
- (removal of old package)
- %postun of old package
- %triggerpostun of old package (if it’s set off by uninstalling the old package)
- %triggerpostun of other packages (if they’re set off by uninstalling the old package)
- %posttrans of new package
Answered By - Aaron D. Marasco