diff options
author | Jindrich Novy <jnovy@redhat.com> | 2008-04-22 12:41:08 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2008-04-22 12:41:08 +0200 |
commit | edc5c0ef84a93d19acecaaf9a07f4ea3e9d8fe39 (patch) | |
tree | c14b2c66c83adc4241b9204056383c2c8f9e0152 /scripts/rpm2cpio.sh | |
parent | fa5c3f2e1025d1d1d34f3f09879a6dec75d2325e (diff) | |
download | librpm-tizen-edc5c0ef84a93d19acecaaf9a07f4ea3e9d8fe39.tar.gz librpm-tizen-edc5c0ef84a93d19acecaaf9a07f4ea3e9d8fe39.tar.bz2 librpm-tizen-edc5c0ef84a93d19acecaaf9a07f4ea3e9d8fe39.zip |
Recognize lzma payload from its magic
- old lzma formats without magic aren't supported
Diffstat (limited to 'scripts/rpm2cpio.sh')
-rwxr-xr-x | scripts/rpm2cpio.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/rpm2cpio.sh b/scripts/rpm2cpio.sh index a9269c70b..b03ee361f 100755 --- a/scripts/rpm2cpio.sh +++ b/scripts/rpm2cpio.sh @@ -23,4 +23,14 @@ dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9` hdrsize=`expr 8 + 16 \* $il + $dl` o=`expr $o + $hdrsize` -dd if=$pkg ibs=$o skip=1 2>/dev/null | gunzip +comp=`dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \ + | dd bs=3 count=1 2>/dev/null` + +gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`" +lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`" +case "$comp" in + BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;; + "$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;; + "$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;; + *) echo "Unrecognized rpm file: $pkg"; return 1 ;; +esac |