summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-09-28 10:53:56 +0200
committerMichał Górny <mgorny@gentoo.org>2022-10-01 19:19:32 +0200
commit3684ec70b53db1d9eb5c25d6e2f2ecf096a6336b (patch)
tree7a265de295940ddee0b18a37103db3ffa6da6ab5 /eclass
parentunpacker.eclass: Add support for makeself 2.4.5 (diff)
downloadgentoo-3684ec70b53db1d9eb5c25d6e2f2ecf096a6336b.tar.gz
gentoo-3684ec70b53db1d9eb5c25d6e2f2ecf096a6336b.tar.bz2
gentoo-3684ec70b53db1d9eb5c25d6e2f2ecf096a6336b.zip
unpacker.eclass: Reuse _unpacker_get_decompressor for makeself
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/unpacker.eclass18
1 files changed, 10 insertions, 8 deletions
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 1fda7a89f3c2..f54d0c3626ab 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})"
}