Search code examples
rpmrpmbuildrpm-spec

Is it possible to write our own rpm -e option?


I have created a rpm build which will extract files as part of rpm installation then run custom scripts to install the package. But when i do rpm -e option it will remove only the rpm extracted files which is not good enough. How can i write rpm -e option to run my custom uninstall script?


Solution

  • You can write a custom %preun or %postun scriptlet.

    That being said, what you are doing is wrong and not following the philosophy of what RPMs are supposed to do. You've made it nearly impossible for an admin to verify the integrity of the files on the system (rpm -V), find out what installed the files on the system (rpm -q --whatprovides), etc. Please reconsider.