3 # This should work with the GNU version of cpio and gzip!
4 # This should work with the bash or ash shell!
5 # Requires the programs (cpio, gzip, and the pager more or less).
8 echo "Usage: unrpm -l package.rpm <List contents of rpm package>"
9 echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,"
10 echo " put . for current directory>"
17 if [ "$rpm" = "" ]; then
19 elif [ ! -s "$rpm" ]; then
20 echo "Can't find $rpm!"
25 if [ "$1" = "" ]; then
27 elif [ "$1" = "-l" ]; then
29 type more >/dev/null 2>&1 && pager=more
30 type less >/dev/null 2>&1 && pager=less
31 [ "$pager" = "" ] && echo "No pager found!" && exit
32 (echo -e "\nPress enter to scroll, q to Quit!\n" ; rpm2cpio $rpm | cpio -tv --quiet) | $pager
34 elif [ "$1" = "-x" ]; then
36 if [ "$3" = "" ]; then
38 elif [ ! -d "$3" ]; then
39 echo "No such directory $3!"
42 rpm2cpio $rpm | (umask 0 ; cd $3 ; cpio -idmuv) || exit
44 echo "Extracted $rpm to $3!"