mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-16 17:46:14 +02:00
eclass/unpacker: Sync with Gentoo
It's from Gentoo commit ec90042d02d365b72f25da5a7ff5d5298df80021. Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
parent
17b9e7a65f
commit
ba5d35ef49
@ -16,7 +16,7 @@
|
||||
# - support partial unpacks?
|
||||
|
||||
case ${EAPI} in
|
||||
7|8) ;;
|
||||
7|8) inherit eapi9-pipestatus ;;
|
||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||
esac
|
||||
|
||||
@ -142,28 +142,23 @@ unpack_pdv() {
|
||||
# | dd ibs=${tailskip} skip=1 \
|
||||
# | gzip -dc \
|
||||
# > ${datafile}
|
||||
local decompress=(cat)
|
||||
if [ ${iscompressed} -eq 1 ] ; then
|
||||
if [ ${istar} -eq 1 ] ; then
|
||||
tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
|
||||
| head -c $((${metaskip}-${tailskip})) \
|
||||
| tar -xzf -
|
||||
decompress=(tar -xzf -)
|
||||
else
|
||||
tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
|
||||
| head -c $((${metaskip}-${tailskip})) \
|
||||
| gzip -dc \
|
||||
> ${datafile}
|
||||
decompress=(gzip -dc)
|
||||
fi
|
||||
else
|
||||
if [ ${istar} -eq 1 ] ; then
|
||||
tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
|
||||
| head -c $((${metaskip}-${tailskip})) \
|
||||
| tar --no-same-owner -xf -
|
||||
else
|
||||
tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
|
||||
| head -c $((${metaskip}-${tailskip})) \
|
||||
> ${datafile}
|
||||
decompress=(tar --no-same-owner -xf -)
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
tail -c +$((${tailskip}+1)) "${src}" 2>/dev/null \
|
||||
| head -c $((${metaskip}-${tailskip})) \
|
||||
"${decompress[@]}" > "${datafile}"
|
||||
true
|
||||
#[ -s "${datafile}" ] || die "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')"
|
||||
#assert "failure unpacking pdv ('${metaskip}' '${tailskip}' '${datafile}')"
|
||||
@ -281,7 +276,7 @@ unpack_makeself() {
|
||||
|
||||
[[ -z ${decomp} ]] && decomp=$(_unpacker_get_decompressor ".${suffix}")
|
||||
"${exe[@]}" | ${decomp} | tar --no-same-owner -xf -
|
||||
assert "failure unpacking (${filetype}) makeself ${src##*/} ('${ver}' +${skip})"
|
||||
pipestatus || die "failure unpacking (${filetype}) makeself ${src##*/} ('${ver}' +${skip})"
|
||||
}
|
||||
|
||||
# @FUNCTION: unpack_deb
|
||||
@ -310,7 +305,7 @@ unpack_deb() {
|
||||
if [[ ${f} = "data.tar"* ]] ; then
|
||||
local decomp=$(_unpacker_get_decompressor "${f}")
|
||||
head -c "${size}" | ${decomp:-cat}
|
||||
assert "unpacking ${f} from ${deb} failed"
|
||||
pipestatus || die "unpacking ${f} from ${deb} failed"
|
||||
break
|
||||
else
|
||||
head -c "${size}" > /dev/null # trash it
|
||||
@ -320,14 +315,14 @@ unpack_deb() {
|
||||
else
|
||||
local f=$(
|
||||
$(tc-getBUILD_AR) t "${deb}" | grep ^data.tar
|
||||
assert "data not found in ${deb}"
|
||||
pipestatus || die "data not found in ${deb}"
|
||||
)
|
||||
local decomp=$(_unpacker_get_decompressor "${f}")
|
||||
$(tc-getBUILD_AR) p "${deb}" "${f}" | ${decomp:-cat}
|
||||
assert "unpacking ${f} from ${deb} failed"
|
||||
pipestatus || die "unpacking ${f} from ${deb} failed"
|
||||
fi
|
||||
} | tar --no-same-owner -xf -
|
||||
assert "unpacking ${deb} failed"
|
||||
pipestatus || die "unpacking ${deb} failed"
|
||||
}
|
||||
|
||||
# @FUNCTION: unpack_cpio
|
||||
@ -491,7 +486,7 @@ unpack_gpkg() {
|
||||
mkdir -p "${dirname}" || die
|
||||
tar -xOf "${gpkg}" "${images[0]}" | ${decomp:-cat} |
|
||||
tar --no-same-owner -C "${dirname}" -xf -
|
||||
assert "Unpacking ${gpkg} failed"
|
||||
pipestatus || die "Unpacking ${gpkg} failed"
|
||||
}
|
||||
|
||||
# @FUNCTION: _unpacker
|
||||
@ -569,7 +564,7 @@ _unpacker() {
|
||||
${comp} < "${a}" | ${arch} -
|
||||
fi
|
||||
|
||||
assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
|
||||
pipestatus || die "unpacking ${a} failed (comp=${comp} arch=${arch})"
|
||||
}
|
||||
|
||||
# @FUNCTION: unpacker
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user