extracting rpms to non-root directories

Saurabh Bathe sbathe at gmail.com
Thu May 12 11:47:10 UTC 2005


Chris Jones wrote:

> Hi,
>
> I'm trying to extract the contents of an rpm to a non-standard place 
> (i.e. non-root) to just get access to the files.
>
> I have in my ~/.rpmmacros
>
> %packager %(echo "$USER")
> %_topdir %(echo "$HOME")/rpmbuild
>
> and this seems to do the trick for "src" rpms. ie.
>
> pcdn > rpm -ivh /tmp/arts-1.1.3-2.2.src.rpm
> warning: /tmp/arts-1.1.3-2.2.src.rpm: V3 DSA signature: NOKEY, key ID 
> db42a60e
>    1:arts                   
> ########################################### [100%]
>
> however, I want to extract the devel files, but if I try the same 
> thing for this rpm, I get
>
> pcdn > rpm -ivh /tmp/xmms-devel-1.2.7-22.1.p.i386.rpm
> warning: /tmp/xmms-devel-1.2.7-22.1.p.i386.rpm: V3 DSA signature: 
> NOKEY, key ID 0c98ff9d
> error: cannot get exclusive lock on /var/lib/rpm/Packages
> error: cannot open Packages index using db3 - Operation not permitted (1)
> error: cannot open Packages database in /var/lib/rpm
>
> what do I need to do to just extract the files in the devel rpm ?
>
> cheers Chris
>
Hi,

I generally do:

cd $HOME/rpmbuild
rpm2cpio /tmp/xmms-devel-1.2.7-22.1.p.i386.rpm | cpio -idv

This will extract the files in the rpm archive to current directory 
while creating any necessary directories.

-Saurabh




More information about the users mailing list