diff options
author | Saul Wold <sgw@linux.intel.com> | 2013-01-18 20:48:33 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-20 13:06:43 +0000 |
commit | e9b73c0b0113a68d599323b67c34726d88e4c5ac (patch) | |
tree | ceb930756e3454aee52c84868a46d0abfb00069a /meta/recipes-devtools/rpm | |
parent | 59e15f671222077db57d394b1f022549fa3509ff (diff) | |
download | poky-e9b73c0b0113a68d599323b67c34726d88e4c5ac.tar.gz |
rpm2cpio: Update to match rpm4 specs for decompression
[YOCTO #3753]
(From OE-Core rev: 1377278187d20853304fe2689105f2848d796d86)
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-rwxr-xr-x | meta/recipes-devtools/rpm/rpm/rpm2cpio | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm2cpio b/meta/recipes-devtools/rpm/rpm/rpm2cpio index 00c4ec549e..6bcef6a4ce 100755 --- a/meta/recipes-devtools/rpm/rpm/rpm2cpio +++ b/meta/recipes-devtools/rpm/rpm/rpm2cpio | |||
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Prevent gawk >= 4.0.x from getting funny ideas wrt UTF in printf() | ||
4 | LANG=C | ||
5 | |||
3 | pkg=$1 | 6 | pkg=$1 |
4 | if [ "$pkg" = "" -o ! -e "$pkg" ]; then | 7 | if [ "$pkg" = "" -o ! -e "$pkg" ]; then |
5 | echo "no package supplied" 1>&2 | 8 | echo "no package supplied" 1>&2 |
@@ -22,30 +25,15 @@ dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9` | |||
22 | 25 | ||
23 | hdrsize=`expr 8 + 16 \* $il + $dl` | 26 | hdrsize=`expr 8 + 16 \* $il + $dl` |
24 | o=`expr $o + $hdrsize` | 27 | o=`expr $o + $hdrsize` |
25 | EXTRACTOR="dd if=$pkg ibs=$o skip=1" | 28 | comp=`dd if=$pkg ibs=$o skip=1 count=1 2>/dev/null | dd bs=3 count=1 2> /dev/null` |
26 | |||
27 | COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null` | ||
28 | if echo $COMPRESSION |grep -q gzip; then | ||
29 | DECOMPRESSOR=gunzip | ||
30 | elif echo $COMPRESSION |grep -q bzip2; then | ||
31 | DECOMPRESSOR=bunzip2 | ||
32 | elif echo $COMPRESSION |grep -q xz; then | ||
33 | DECOMPRESSOR=unxz | ||
34 | elif echo $COMPRESSION |grep -q cpio; then | ||
35 | DECOMPRESSOR=cat | ||
36 | else | ||
37 | # Most versions of file don't support LZMA, therefore we assume | ||
38 | # anything not detected is LZMA | ||
39 | DECOMPRESSOR=`which unlzma 2>/dev/null` | ||
40 | case "$DECOMPRESSOR" in | ||
41 | /* ) ;; | ||
42 | * ) DECOMPRESSOR=`which lzmash 2>/dev/null` | ||
43 | case "$DECOMPRESSOR" in | ||
44 | /* ) DECOMPRESSOR="lzmash -d -c" ;; | ||
45 | * ) DECOMPRESSOR=cat ;; | ||
46 | esac | ||
47 | ;; | ||
48 | esac | ||
49 | fi | ||
50 | 29 | ||
51 | $EXTRACTOR 2>/dev/null | $DECOMPRESSOR | 30 | gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`" |
31 | lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`" | ||
32 | xz="`echo . | awk '{ printf("%c7z", 0xfd); }'`" | ||
33 | case "$comp" in | ||
34 | BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;; | ||
35 | "$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;; | ||
36 | "$xz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | xzcat ;; | ||
37 | "$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;; | ||
38 | *) echo "Unrecognized rpm file: $pkg"; exit 1 ;; | ||
39 | esac | ||