Re: How to run a tool stored in RPM package upon uninstallation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



serbenet@xxxxxxx wrote:
> I basically want a small tool to be executed when my rpm is being
> uninstalled by the user. This tool should be embedded in the RPM
> package but should be extracted only upon uninstallation, and should
> be removed after being run. I can not use the %file directive to
> include this tool in my package since I do not want this file to
> actually be "installed" or stored on the user's system.

First you do need to install it using a %file location someplace on
the system and it will live there while the package is installed.  But
put it someplace out of the way.  If the program is architecture
independent (that is, a script) then I would install it in
/usr/share/<pkgname>/postun/scriptfile, or just embed the actions in
the rpm %preun script.  If the program is a binary executable then I
would install it in /usr/lib/<pkgname>/postun/progfile or some such
locations.  They will be on the system but out of the way.  Then upon
uninstall, in the %preun script section, invoke your special uninstall
program.

The ordering is that the %preun actions run, %files are uninstalled,
the %postun actions run.  If you need to have this run in the %postun
section after the %files have been removed then I think you would need
to copy the special uninstall program to /tmp/<pkgname>/prog in a
secured subdirectory to save it from the %files removal and then in
the %postun call the program.  After the run in the %postun
continuation you can remove the /tmp/<pkgname> directory to clean up.

Test and verify everything.

Bob

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux