/[gentoo-x86]/eclass/unpacker.eclass
Gentoo

Diff of /eclass/unpacker.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.9
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.6 2012/04/05 03:20:42 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.9 2012/05/11 07:46:44 vapier Exp $
4 4
5# @ECLASS: unpacker.eclass 5# @ECLASS: unpacker.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs 8# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs
251 251
252 local deb=$(find_unpackable_file "$1") 252 local deb=$(find_unpackable_file "$1")
253 253
254 unpack_banner "${deb}" 254 unpack_banner "${deb}"
255 255
256 # on AIX ar doesn't work out as their ar used a different format
257 # from what GNU ar (and thus what .deb files) produce
258 if [[ -n ${EPREFIX} ]] ; then
259 {
260 read # global header
261 [[ ${REPLY} = "!<arch>" ]] || die "${deb} does not seem to be a deb archive"
262 local f timestamp uid gid mode size magic
263 while read f timestamp uid gid mode size magic ; do
264 [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines
265 if [[ ${f} = "data.tar"* ]] ; then
266 head -c "${size}" > "${f}"
267 else
268 head -c "${size}" > /dev/null # trash it
269 fi
270 done
271 } < "${deb}"
272 else
256 ar x "${deb}" 273 ar x "${deb}"
274 fi
275
257 unpack ./data.tar* 276 unpacker ./data.tar*
258} 277}
259 278
260# @FUNCTION: _unpacker 279# @FUNCTION: _unpacker
261# @USAGE: <one archive to unpack> 280# @USAGE: <one archive to unpack>
262# @INTERNAL 281# @INTERNAL
271 a=$(find_unpackable_file "${a}") 290 a=$(find_unpackable_file "${a}")
272 291
273 # first figure out the decompression method 292 # first figure out the decompression method
274 case ${m} in 293 case ${m} in
275 *.bz2|*.tbz|*.tbz2) 294 *.bz2|*.tbz|*.tbz2)
276 local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P pbzip2 || bzip2)} 295 local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P pbzip2 || type -P bzip2)}
277 local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} 296 local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${bzcmd} -d}
278 : ${UNPACKER_BZ2:=${bzuncmd}} 297 : ${UNPACKER_BZ2:=${bzuncmd}}
279 comp="${UNPACKER_BZ2} -c" 298 comp="${UNPACKER_BZ2} -c"
280 ;; 299 ;;
281 *.z|*.gz|*.tgz) 300 *.z|*.gz|*.tgz)
282 comp="gzip -dc" ;; 301 comp="gzip -dc" ;;
292 arch="tar --no-same-owner -xof" ;; 311 arch="tar --no-same-owner -xof" ;;
293 *.deb) 312 *.deb)
294 arch="unpack_deb" ;; 313 arch="unpack_deb" ;;
295 *.run) 314 *.run)
296 arch="unpack_makeself" ;; 315 arch="unpack_makeself" ;;
316 *.sh)
317 # Not all shell scripts are makeself
318 if head -n 30 "${a}" | grep -qs '#.*Makeself' ; then
319 arch="unpack_makeself"
320 fi
321 ;;
297 *.bin) 322 *.bin)
298 # Makeself archives can be annoyingly named 323 # Makeself archives can be annoyingly named
299 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then 324 if head -c 100 "${a}" | grep -qs '#.*Makeself' ; then
300 arch="unpack_makeself" 325 arch="unpack_makeself"
301 fi 326 fi

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20