Search code examples
upgraderpmrpm-spec

during upgrade, how does rpm know which files to delete?


I am new to packaging.

This website states that the steps during an upgrade are:

Hence, the order of operations during an upgrade is:

  1. Run the %pre section of the RPM being installed.
  2. Install the files that the RPM provides.
  3. Run the %post section of the RPM.
  4. Run the %preun of the old package.
  5. Delete any old files not overwritten by the newer version. (This step deletes files that the new package does not require.)
  6. Run the %postun hook of the old package.

Regarding step 5, how exactly does it determine which files it should delete? Does it only delete files that are part of the %install/%post step of the old version? Or would any files in the install dir (if the concept of "the install dir" even makes sense) that is not part of the new version's %install/%post get deleted?


Solution

  • The files listed in the %files section. That's why they're needed to be explicitly given.

    You didn't mention that if they are tagged %config they won't be overwritten.