AFAIK In the RPM world the %post
script is considered to execute after the package has been installed.
At the point the contents of the package have been copied to their location on disk and RPM database has been updated and dependent tools such as yum
and dnf
consider the package "installed".
That is why by convention the %post
script can't fail (or should never result in an exit code other than 0
) See the packaging guidelines
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, leaving behind duplicate rpmdb entries and possibly stale, unowned files on the filesystem.
One solution for when you want to know if the package is installed correctly, is to add a %verifyscript
section that can confirm if the %post script did the right thing(s) and run rpm --verify [package]