Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rpm -qpl 1

Status
Not open for further replies.

fluid11

IS-IT--Management
Jan 22, 2002
1,627
US
Lets say I have an rpm package called ibm.rpm. I want to extract just one file (libjitc.so) from the package. I ran the...

rpm -qpl ibm.rpm | grep libjitc.so

...command to see if the file I need is there. It is and it gives me the path to which it will be installed, which was /opt/IBMJava2-13/jre/bin/libjitc.so. How do I just extract this one file to the directory that I choose without installing the entire package?

Thanks in advance,
ChrisP

 
Hi,









You can use rpm2cpio for this :









cd tempdir




rpm2cpio whatever-1.0-1.i386.rpm |cpio -ivd usr/lib/whatever/afile

or maybe (depending on rpm)
rpm2cpio whatever-1.0-1.i386.rpm |cpio -ivd ./usr/lib/whatever/afile









That would create the file in the current directory. For example, if you did it from '/root' then you'd get '/root/usr/lib/whatever/afile'. You have to use the long path as per the rpm archive but leave off the leading '/' in the cpio command to get it to place output in the current directory.






You can do the following to see how the cpio archive looks (list) :



rpm2cpio whatever-1.0-1.i386.rpm |cpio -t






Hope this helps
 
Thanks ifincham, it worked. Never heard of those commands before. Do I have to specify the full path to the file in the .rpm? It works, but then I have to copy the file I need to a different location and delete the temp folders. Can I specify where to copy the file from the .rpm directly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top