Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting more intelligent way of uninstalling a RPM Post 302139820 by _Spare_Ribs_ on Tuesday 9th of October 2007 11:11:19 AM
Old 10-09-2007
more intelligent way of uninstalling a RPM

Hi all,

I'm writing an uninstaller for a bespoke piece of software that we deploy to our Linux terminals.

One of the packages we install is the JDK (Java Development Kit). Now over the years we have quite a number of different versions installed with different package names. In my uninstaller I want to give the option to uninstall this package. The obvious way, but not very intelligent is just go through a nice long if/else loop of all the different package names it could be until it finds a match. It will work but it's not very intelligent and every time the package name changes I need to update my uninstaller.

So I guess I'm looking for a clever way to query the rpm database or some other way that will give me the package name of the JDK installed so I can just pass this to the rpm -e command.

If I do "rpm -aqi | grep Name" this is provides me with a basic list of every package name installed. I could go further and add "| java" on the end but this would only return results where the word java appeared in the Name line which it doesn't in all JDK distributions. I can use the rpm -q to query if the package exists but this relies on me knowing the package name in the first place.

Anyone got any good suggestions? I'm probably missing something blindingly obvious but I've had a good look through the man page for rpm and I can't see to find anything.

Thanks for any help.

Last edited by _Spare_Ribs_; 10-09-2007 at 12:52 PM..
Test Your Knowledge in Computers #927
Difficulty: Medium
32-bit versions of the Unix time stamp will cease to work at 03:14:08 UTC on Tuesday, 19 January 2038.
True or False?

9 More Discussions You Might Find Interesting

1. Linux

Failed dependencies of rpm / how does RPM check for ?

Hey, I've a problem installing a package. rpm -ivh brings the errors: is needed by is needed by But I have installed the Java SDK like requested and the files are on the disk. But I have no idea how to find out, why rpm cann't find them. I have also... (2 Replies)
Discussion started by: mod
2 Replies

2. UNIX for Dummies Questions & Answers

A more intelligent SDIFF

Hi all I have two files which are essentially the same. However the way an exponent is written is different (i.e. in 1 file, a particular number might be written as 1.43230000E+02 whereas in another it might be 1.4323E2). If I use SDIFF then the program will merely check the ASCII characters... (1 Reply)
Discussion started by: robbiegregg
1 Replies

3. Linux

Converting source rpm to binary rpm

Hi, I need to install an rpm file,but I only have '.src.rpm' version of it. I want to convert it to a binary rpm. so I tried this rpm --rebuild somethin.src.rpm But I am gettin '--rebuild:Invalid option' as output Is there another way to rebuild source rpm.? Thanks in... (2 Replies)
Discussion started by: eamani_sun
2 Replies

4. Linux

how to restore original package after uninstalling the upgraded package using rpm

have following package installed rpm -qa |grep ADMIN It will give the following package installed: ADMIN- Now I will upgrade the ADMIN package using the following command. rpm --upgrade ADMIN- It will upgrade the ADMIN packagge to ADMIN- Now I want that... (0 Replies)
Discussion started by: amitpansuria
0 Replies

5. SuSE

How to install .src.rpm ? ( source rpm )

Hi, I have got few RPM's from ( mainly gcc ). But it seems to be src files instead of the image. so I think we have to build the src files according to target machine using rpmbuild. Can any one help me with 1) Various options of rpm build that have to be taken care 2)... (3 Replies)
Discussion started by: Sivaswami
3 Replies

6. Linux

Uninstalling a broken software rpm in Linux

Hi, I have a installed a package(some X) on my linux machine. But now I want to unistall it but some of the file required for unistalltion are missing. Can someone tell me how to remove that rpm (package) from my machine. I am trying Install it again. But for it, i need to uninstall it... (1 Reply)
Discussion started by: eamani_sun
1 Replies

7. Shell Programming and Scripting

Extract RPM name from path to .rpm file

It's the end of the day and I just can't get my head around this. I'm trying to extract just the name of the RPM from the path to a .rpm file. So from: /home/me/rpm/RPMS/i386/nagios-our-plugins-1.2-6.i386.rpmI need to extract 'nagios-our-plugins'. I can't get the awk syntax right: awk '{... (5 Replies)
Discussion started by: aussieos
5 Replies

8. Shell Programming and Scripting

How to make RPM not write to RPM database if RPM fails to deploy?

How to make RPM not write to RPM database if RPM fails to deploy? IE I create an rpm spec file that contains the following if then exit 1 fi My rpm will fail at deployment, but if I do rpm -qa , I can see the rpm in the rpm db (3 Replies)
Discussion started by: 3junior
3 Replies

9. AIX

Rpm issue with autoconf-2.63-1.AIX6.1.noarch.rpm

dears i am trying to install the autoconf-2.63-1.aix6.1.noarch.rpm but its shows the below error message . P700_dev/svn/dependencies>rpm -i autoconf-2.63-1.aix6.1.noarch.rpm error: failed dependencies: m4 is needed by autoconf-2.63-1 P700_dev/svn/dependencies> (6 Replies)
Discussion started by: thecobra151
6 Replies
wsreg_set_uninstaller(3WSREG)			    Product Install Registry Library Functions			     wsreg_set_uninstaller(3WSREG)

wsreg_set_uninstaller, wsreg_get_uninstaller - set or get the uninstaller of a component SYNOPSIS
cc [flag ...] file ...-lwsreg [library ...] #include <wsreg.h> int wsreg_set_uninstaller(Wsreg_component *comp, const char *uninstaller); char *wsreg_set_uninstaller(const Wsreg_component *comp); DESCRIPTION
The wsreg_set_uninstaller() function sets the uninstaller specified by uninstaller in the component specified by comp. If an uninstaller has already been set in the specified component, the resources associated with the previously set uninstaller are released. The wsreg_get_uninstaller() function gets the uninstaller string from the component specified by comp. The resulting string must be released by the caller. RETURN VALUES
The wsreg_set_uninstaller() function returns a non-zero value if the uninstaller was set correctly; otherwise 0 is returned. The wsreg_get_uninstaller() function returns a copy of the uninstaller from the specified component. USAGE
An uninstaller is usually only associated with a product, not with every component that comprises a product. The uninstaller string is a command that can be passed to the shell to launch the uninstaller. If an uninstaller is set in a registered component, the prodreg(1M) registry viewer will provide an uninstall button that will invoke the uninstaller. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
prodreg(1M), wsreg_initialize(3WSREG), attributes(5) SunOS 5.10 22 Sep 2000 wsreg_set_uninstaller(3WSREG)

Featured Tech Videos

All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy