Extract 1 file from RPM

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

Extract 1 file from RPM

Post by cah »

To find out where the file will get installed if you install the whole package run this command

Code: Select all

# rpm -qlp kernel-2.6.32-431.17.1.el6.x86_64.rpm | grep pvscsi
/lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/vmw_pvscsi.ko
Now that i have /lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/vmw_pvscsi.ko as the location I can use rpm2cpio to grab just that file.

Code: Select all

# rpm2cpio kernel-2.6.32-431.17.1.el6.x86_64.rpm | cpio -ivd ./lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/vmw_pvscsi.ko
That should place a file in ./lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/vmw_pvscsi.ko. Notice I have a . (period) in front. It will create the lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/ and then place vmw_pvscsi.ko in that dir in whatever dir you are in. So in my example i was in /home/hsiaoc1 so all the full path to vmw_pvscsi.ko is

/home/hsiaoc1/lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/scsi/vmw_pvscsi.ko

From there i could move it to /usr/bin and delete /tmp/usr and also the rpm.
CAH, The Great
Post Reply