LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > Lumak's Guide to Random Things
User Name
Password

Notices


OK I don't really have a good title yet but I figure I can post works in progress and other tips I've come across or other interesting things.
Rate this Entry

A script to extract RPMs

Posted 11-29-2008 at 11:44 PM by lumak
Updated 11-30-2008 at 10:59 PM by lumak

Since my blog is a guide to random things... here is a nice bash script to extract RPMs to a directory named after them self where the RPM can be located anywhere... that is, relative to the current directory or exact path

Code:
#!/bin/sh
#
# This script is in the public domain.
#
# A simple script to extract RPM files automagically
# Honestly... why isn't this feature built into
# the rpm tools?! unless I missed something...

RPM="$1"
CWD=`pwd`

DESTDIR="$CWD/"`basename $RPM .rpm`
mkdir "$DESTDIR"
cd "$DESTDIR"
if [ -f "$RPM" ]; then
  FILE="$RPM"
elif [ -f "$CWD/$RPM" ]; then
  FILE="$CWD/$RPM"
fi

rpm2cpio $FILE | cpio -idmv
Views 1979 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    thankyou.
    Posted 12-01-2008 at 02:56 AM by hasanatizaz hasanatizaz is offline
 

  



All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration