#!/bin/sh if [ "$1" = "" ]; then echo "rpm2targz: Converts \"unreadable\" RPM format to GNU tar + GNU zip format" echo "Usage: rpm2targz " echo " (Outputs \"file.tar.gz\")" exit 1; fi for i in $* ; do if [ ! "$1" = "$*" ]; then echo "Processing file: $i" fi mkdir /tmp/rpm2targz$$ ofn=`basename $i .rpm`.cpio dd ibs=`rpmoffset < $i` skip=1 if=$i 2> /dev/null | gzip -dc > /tmp/rpm2targz$$/$ofn ( cd /tmp/rpm2targz$$ cpio --extract --preserve-modification-time --make-directories < $ofn 1> /dev/null 2> /dev/null rm -f $ofn find . -type d -perm 700 -exec chmod 755 {} \; tar czf - . ) > `basename $i .rpm`.tar.gz ( cd /tmp ; rm -rf rpm2targz$$ ) done