I ran into a problem with my services that I upgraded not being restarted. The problem stemmed from a misunderstanding on my part of the order of operations. I assumed (incorrectly) that the preun script was executed before files were removed or updated.
This information is from IBM @ http://www.ibm.com/developerworks/library/l-rpm2/
The actual order is:
- Run the %pre section of the RPM being installed.
- Install the files that the RPM provides.
- Run the %post section of the RPM.
- Run the %preun of the old package.
- Delete any old files not overwritten by the newer version. (This step deletes files that the new package does not require.)
- Run the %postun hook of the old package.
Hooks:
- All commands listed in the %pre hook run before your package is installed.
- Commands in the %post hook run after your package has been installed.
- The %preun hook runs before your package is removed from the system.
- Commands in the %postun hook run after your package is removed from the system.
Arguments:
- If the first argument to %pre is 1, the RPM operation is an initial installation. If the argument to %pre is 2, the operation is an upgrade from an existing version to a new one.
- Similarly, the arguments to a %post are 1 and 2 for a new installation and upgrade, respectively. (Again, %pre and %post aren’t executed during an uninstallation.)
- If the first argument to %preun and %postun is 1, the action is an upgrade.
- If the first argument to %preun and %postun is 0, the action is uninstallation.