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

Diff of /eclass/unpacker.eclass

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

Revision 1.9 Revision 1.10
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.9 2012/05/11 07:46:44 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.10 2012/08/22 01:41:12 ottxor 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
274 fi 274 fi
275 275
276 unpacker ./data.tar* 276 unpacker ./data.tar*
277} 277}
278 278
279# @FUNCTION: unpack_cpio
280# @USAGE: <one cpio to unpack>
281# @DESCRIPTION:
282# Unpack a cpio archive, file "-" means stdin.
283unpack_cpio() {
284 [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"
285
286 # needed as cpio always reads from stdin
287 local cpio_cmd=( cpio --make-directories --extract --preserve-modification-time )
288 if [[ $1 == "-" ]] ; then
289 unpack_banner "stdin"
290 "${cpio_cmd[@]}"
291 else
292 local cpio=$(find_unpackable_file "$1")
293 unpack_banner "${cpio}"
294 "${cpio_cmd[@]}" <"${cpio}"
295 fi
296}
297
279# @FUNCTION: _unpacker 298# @FUNCTION: _unpacker
280# @USAGE: <one archive to unpack> 299# @USAGE: <one archive to unpack>
281# @INTERNAL 300# @INTERNAL
282# @DESCRIPTION: 301# @DESCRIPTION:
283# Unpack the specified archive. We only operate on one archive here 302# Unpack the specified archive. We only operate on one archive here
307 # then figure out if there are any archiving aspects 326 # then figure out if there are any archiving aspects
308 arch="" 327 arch=""
309 case ${m} in 328 case ${m} in
310 *.tgz|*.tbz|*.tbz2|*.txz|*.tar.*|*.tar) 329 *.tgz|*.tbz|*.tbz2|*.txz|*.tar.*|*.tar)
311 arch="tar --no-same-owner -xof" ;; 330 arch="tar --no-same-owner -xof" ;;
331 *.cpio.*|*.cpio)
332 arch="unpack_cpio" ;;
312 *.deb) 333 *.deb)
313 arch="unpack_deb" ;; 334 arch="unpack_deb" ;;
314 *.run) 335 *.run)
315 arch="unpack_makeself" ;; 336 arch="unpack_makeself" ;;
316 *.sh) 337 *.sh)
379 400
380 [[ $# -eq 0 ]] && set -- ${SRC_URI} 401 [[ $# -eq 0 ]] && set -- ${SRC_URI}
381 402
382 for uri in "$@" ; do 403 for uri in "$@" ; do
383 case ${uri} in 404 case ${uri} in
405 *.cpio.*|*.cpio)
406 d="app-arch/cpio" ;;
384 *.rar|*.RAR) 407 *.rar|*.RAR)
385 d="app-arch/unrar" ;; 408 d="app-arch/unrar" ;;
386 *.7z) 409 *.7z)
387 d="app-arch/p7zip" ;; 410 d="app-arch/p7zip" ;;
388 *.xz) 411 *.xz)

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

  ViewVC Help
Powered by ViewVC 1.1.20