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).
9
Usage: unrpm -l package.rpm <List contents of rpm package>
10
unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,
11
put . for current directory>
19
if [ -z "${rpm}" ]; then
21
elif [ ! -s "${rpm}" ]; then
22
echo "Can't find ${rpm}!"
29
elif [ "$1" = "-l" ]; then
31
type more >/dev/null 2>&1 && pager=more
32
type less >/dev/null 2>&1 && pager=less
33
[ "$pager" = "" ] && echo "No pager found!" && exit
35
printf "\nPress enter to scroll, q to Quit!\n\n"
36
rpm2cpio "${rpm}" | cpio -tv --quiet
39
elif [ "$1" = "-x" ]; then
43
elif [ ! -d "$3" ]; then
44
echo "No such directory $3!"
47
rpm2cpio "${rpm}" | (umask 0 ; cd "$3" ; cpio -idmuv) || exit
49
echo "Extracted ${rpm} to $3!"