-1

I have built an RPM package and to install the package I run

rpm -Uvh --force rpm_package_name.rpm

Is there any command that I can define in spec during rpm build so that it uninstalls the package in single go, just like install works.

abhishek
  • 163
  • 1
  • 1
  • 7

1 Answers1

1

NO.

you cannot force in advance how the user will use rpm, zypper or yum to install or uninstall your package.

The question I would ask: how come the user needs to use --force to uninstall your rpm? In that case I would suggest you to try building an rpm that does not need special flags to get uninstalled.

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • I am using ```--force``` to install the ```rpm``` (as user might be installing same package twice) and not to uninstall it. Actually when I install my rpm package it gets installed under /usr/lib/test/ , all I want it when user uses uninstall with my rpm package name then all the files and folders inside /usr/lib/test/gets deleted. – abhishek Jul 04 '19 at 18:21
  • 1
    if you uninstall the `rpm`, then all files listed in the `%files` section of the spec file will be removed as well. – Chris Maes Jul 05 '19 at 07:48
  • can you help me with the command to uninstall rpm package that has been build using ```rpmbuild```, as ```rpm -e rpm_package_name.rpm``` is not working – abhishek Jul 05 '19 at 13:58
  • `rpm -e` should work. If it does not work you should ask a new question. – Chris Maes Jul 05 '19 at 14:47