If you upgrade a package with %pre, %post, %preun, %postun, scripts by command rpm -U package_name the uninstall scripts (e.g. %postun) of old package runs after the install script of the new package. For example the new package make changes in configuration files but the old removes them... Reproducible: In some cases Steps to Reproduce: 1. Get a package with scripts (e.g. vacation from contrib) 2. Install it 3. Build a new release 4. Upgrade it with rpm -U Workaround: User rpm -e after rpm -i to upgrade a package, but in case of more complex package dependencies it is problematic.
Yes, rpm installs before remove. The order of script execution (including triggers) is in /usr/share/doc/rpm-*/triggers
I'm surprised this is NOTABUG - I have just come across it myself and the behaviour, although as documented, is very non-intuitive. In my case the postinstall script copies a file to a predefined location and the postuninstall removes it. This means that on upgrade the file is copied and then deleted by the removal of the old package! Is there a workaround apart from not using rpm -U ?