summaryrefslogtreecommitdiff
path: root/eclass/unpacker.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/unpacker.eclass')
-rw-r--r--eclass/unpacker.eclass41
1 files changed, 31 insertions, 10 deletions
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 6c9bcbdd7a7b..3d8bf7a8452d 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -218,6 +218,14 @@ unpack_makeself() {
skip=$(head -n ${skip} "${src}" | wc -c)
exe="dd"
;;
+ 2.4.5)
+ # e.g.: skip="713"
+ skip=$(
+ sed -n -e '/^skip=/{s:skip="\(.*\)":\1:p;q}' "${src}"
+ )
+ skip=$(head -n "${skip}" "${src}" | wc -c)
+ exe="dd"
+ ;;
*)
eerror "I'm sorry, but I was unable to support the Makeself file."
eerror "The version I detected was '${ver}'."
@@ -235,30 +243,43 @@ 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}"
- "${exe[@]}" 2>/dev/null | head -c 512 > "${tmpfile}"
- filetype=$(file -b "${tmpfile}") || die
+ local decomp= filetype suffix
+ filetype=$("${exe[@]}" 2>/dev/null | head -c 512 | file -b -) || 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
+ ;;
+ Zstandard*)
+ suffix=zst
+ ;;
+ lzop*)
+ suffix=lzo
+ ;;
+ LZ4*)
+ suffix=lz4
+ ;;
+ "ASCII text"*)
+ decomp='base64 -d'
;;
*)
- 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})"
}