1 |
commit: 3684ec70b53db1d9eb5c25d6e2f2ecf096a6336b |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 28 08:53:56 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 1 17:19:32 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3684ec70 |
7 |
|
8 |
unpacker.eclass: Reuse _unpacker_get_decompressor for makeself |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
eclass/unpacker.eclass | 18 ++++++++++-------- |
13 |
1 file changed, 10 insertions(+), 8 deletions(-) |
14 |
|
15 |
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass |
16 |
index 1fda7a89f3c2..f54d0c3626ab 100644 |
17 |
--- a/eclass/unpacker.eclass |
18 |
+++ b/eclass/unpacker.eclass |
19 |
@@ -243,30 +243,32 @@ unpack_makeself() { |
20 |
esac |
21 |
|
22 |
# lets grab the first few bytes of the file to figure out what kind of archive it is |
23 |
- local filetype tmpfile="${T}/${FUNCNAME}" |
24 |
+ local decomp= filetype suffix tmpfile="${T}/${FUNCNAME}" |
25 |
"${exe[@]}" 2>/dev/null | head -c 512 > "${tmpfile}" |
26 |
filetype=$(file -b "${tmpfile}") || die |
27 |
case ${filetype} in |
28 |
*tar\ archive*) |
29 |
- "${exe[@]}" | tar --no-same-owner -xf - |
30 |
+ decomp=cat |
31 |
;; |
32 |
bzip2*) |
33 |
- "${exe[@]}" | bzip2 -dc | tar --no-same-owner -xf - |
34 |
+ suffix=bz2 |
35 |
;; |
36 |
gzip*) |
37 |
- "${exe[@]}" | tar --no-same-owner -xzf - |
38 |
+ suffix=gz |
39 |
;; |
40 |
compress*) |
41 |
- "${exe[@]}" | gunzip | tar --no-same-owner -xf - |
42 |
+ suffix=z |
43 |
;; |
44 |
XZ*) |
45 |
- "${exe[@]}" | unxz | tar --no-same-owner -xf - |
46 |
+ suffix=xz |
47 |
;; |
48 |
*) |
49 |
- eerror "Unknown filetype \"${filetype}\" ?" |
50 |
- false |
51 |
+ die "Unknown filetype \"${filetype}\", for makeself ${src##*/} ('${ver}' +${skip})" |
52 |
;; |
53 |
esac |
54 |
+ |
55 |
+ [[ -z ${decomp} ]] && decomp=$(_unpacker_get_decompressor ".${suffix}") |
56 |
+ "${exe[@]}" | ${decomp} | tar --no-same-owner -xf - |
57 |
assert "failure unpacking (${filetype}) makeself ${src##*/} ('${ver}' +${skip})" |
58 |
} |