[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 2/5] unpacker.eclass: Reuse _unpacker_get_decompressor for makeself
From: Michał Górny <mgorny () gentoo ! org>
Date: 2022-09-28 20:59:04
Message-ID: 20220928205907.15979-3-mgorny () gentoo ! org
[Download RAW message or body]
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/unpacker.eclass | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 86641621c949..660cafce5105 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -243,30 +243,32 @@ unpack_makeself() {
esac
# lets grab the first few bytes of the file to figure out what kind of archive it is
- local filetype tmpfile="${T}/${FUNCNAME}"
+ local decomp= filetype suffix tmpfile="${T}/${FUNCNAME}"
"${exe[@]}" 2>/dev/null | head -c 512 > "${tmpfile}"
filetype=$(file -b "${tmpfile}") || die
case ${filetype} in
*tar\ archive*)
- "${exe[@]}" | tar --no-same-owner -xf -
+ decomp=cat
;;
bzip2*)
- "${exe[@]}" | bzip2 -dc | tar --no-same-owner -xf -
+ suffix=bz2
;;
gzip*)
- "${exe[@]}" | tar --no-same-owner -xzf -
+ suffix=gz
;;
compress*)
- "${exe[@]}" | gunzip | tar --no-same-owner -xf -
+ suffix=z
;;
XZ*)
- "${exe[@]}" | unxz | tar --no-same-owner -xf -
+ suffix=xz
;;
*)
- eerror "Unknown filetype \"${filetype}\" ?"
- false
+ die "Unknown filetype \"${filetype}\", for makeself ${src##*/} ('${ver}' +${skip})"
;;
esac
+
+ [[ -z ${decomp} ]] && decomp=$(_unpacker_get_decompressor ".${suffix}")
+ "${exe[@]}" | ${decomp} | tar --no-same-owner -xf -
assert "failure unpacking (${filetype}) makeself ${src##*/} ('${ver}' +${skip})"
}
--
2.37.3
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic