Magellan Linux

Annotation of /trunk/rpm2targz/patches/rpm2targz-9.0-bzip2_rpm2targz.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years, 1 month ago) by niro
File size: 2100 byte(s)
-import

1 niro 153 --- rpm2targz 2003-10-15 00:46:48.000000000 +0200
2     +++ rpm2targz.new 2003-10-15 01:39:00.000000000 +0200
3     @@ -21,6 +21,8 @@
4     # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5     #
6    
7     +# debug switch to allow to bypass use of rpm2cpio provided by the rpm package
8     +USERPM2CPIO=true
9     if [ "$TMPDIR" = "" ]; then
10     TMPDIR=/tmp
11     fi
12     @@ -46,7 +48,7 @@
13     fi
14     for i in $* ; do
15     if [ ! "$1" = "$*" ]; then
16     - echo -n "Processing file: $i"
17     + echo "Processing file: $i"
18     fi
19     rm -rf $TMPDIR/rpm2targz$COOKIE # clear the way, just in case of mischief
20     mkdir $TMPDIR/rpm2targz$COOKIE
21     @@ -68,7 +70,7 @@
22     fi
23    
24     ofn=$TMPDIR/rpm2targz$COOKIE/`basename $i .rpm`.cpio
25     - if which rpm2cpio 1> /dev/null 2> /dev/null ; then
26     + if $USERPM2CPIO && which rpm2cpio 1> /dev/null 2> /dev/null ; then
27     rpm2cpio $i > $ofn 2> /dev/null
28     if [ ! $? = 0 ]; then
29     echo "... rpm2cpio failed. (maybe $i is not an RPM?)"
30     @@ -76,7 +78,31 @@
31     continue
32     fi
33     else # less reliable than rpm2cpio...
34     - dd ibs=`rpmoffset < $i` skip=1 if=$i 2> /dev/null | gzip -dc > $ofn
35     + # get offset of start of payload
36     + PAYLOADOFFSET=`rpmoffset < $i`
37     + #identify compression
38     + PAYLOADHEAD=`dd ibs=${PAYLOADOFFSET} skip=1 if=$i 2> /dev/null | dd bs=10 count=1 2> /dev/null`
39     + if echo ${PAYLOADHEAD} | grep -e $'^\037\213' > /dev/null ; then
40     + echo "found gzip magic bytes"
41     + decomp="gzip"
42     + elif echo ${PAYLOADHEAD} | grep -e "^BZh" > /dev/null ; then
43     + echo "found bzip magic bytes"
44     + decomp="bzip2"
45     + else
46     + echo " $i - no magic compression identifier found - skipping file"
47     + ( cd $TMPDIR ; rm -rf rpm2targz$COOKIE )
48     + continue
49     + fi
50     + echo -n " trying to decompress with ${decomp}..."
51     + dd ibs=`rpmoffset < $i` skip=1 if=$i 2> /dev/null | ${decomp} -dc > $ofn 2> /dev/null
52     + if [ $? = 0 ]; then
53     + echo " OK"
54     + else
55     + echo " FAILED"
56     + echo " $i failed to decompress - skipping file"
57     + ( cd $TMPDIR ; rm -rf rpm2targz$COOKIE )
58     + continue
59     + fi
60     fi
61     DEST=$TMPDIR/rpm2targz$COOKIE
62     #if [ "$isSource" = "1" ]; then