I see no uninstall section in RPM spec documentation. I do see preun and postun.
Correct.
The %install section of an RPM spec file is not run on rpm package installation (the name is misleading in that sense). The %install section is run during package creation to install the files that need to be packaged such that the rpmbuild process can package them up.
As such, as because the %files section lists all the files and directories that the package contains the uninstallation process for an rpm is simply the removal of all the packaged files.
If additional work needs to be done before or after the files are removed the %preun and %postun scriptlets are available in the spec file for that work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With