diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-26 19:27:42 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-26 19:27:42 +0000 |
commit | 8f2b2574bebbaab75fe3731a77de1203f3f87c2e (patch) | |
tree | 8ad2dc1dd293ac831b95264450770cb2db68cca2 /app-arch/makeself | |
parent | Add realcodecs to base use.mask (diff) | |
download | gentoo-2-8f2b2574bebbaab75fe3731a77de1203f3f87c2e.tar.gz gentoo-2-8f2b2574bebbaab75fe3731a77de1203f3f87c2e.tar.bz2 gentoo-2-8f2b2574bebbaab75fe3731a77de1203f3f87c2e.zip |
Add a script to unpack makeself archives.
(Portage version: 2.2_rc23/cvs/Linux x86_64)
Diffstat (limited to 'app-arch/makeself')
-rw-r--r-- | app-arch/makeself/ChangeLog | 8 | ||||
-rwxr-xr-x | app-arch/makeself/files/makeself-unpack | 90 | ||||
-rw-r--r-- | app-arch/makeself/makeself-2.1.5.ebuild | 9 |
3 files changed, 99 insertions, 8 deletions
diff --git a/app-arch/makeself/ChangeLog b/app-arch/makeself/ChangeLog index 3f1fd057b558..c96676ad3566 100644 --- a/app-arch/makeself/ChangeLog +++ b/app-arch/makeself/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for app-arch/makeself -# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-arch/makeself/ChangeLog,v 1.20 2008/07/24 17:33:26 armin76 Exp $ +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/makeself/ChangeLog,v 1.21 2009/02/26 19:27:42 vapier Exp $ + + 26 Feb 2009; Mike Frysinger <vapier@gentoo.org> +files/makeself-unpack, + makeself-2.1.5.ebuild: + Add a script to unpack makeself archives. 24 Jul 2008; Raúl Porcel <armin76@gentoo.org> makeself-2.1.5.ebuild: x86 stable wrt #231074 diff --git a/app-arch/makeself/files/makeself-unpack b/app-arch/makeself/files/makeself-unpack new file mode 100755 index 000000000000..fc72fe67cf93 --- /dev/null +++ b/app-arch/makeself/files/makeself-unpack @@ -0,0 +1,90 @@ +#!/bin/bash + +# Glue to keep unpack_makeself() unchanged +source /etc/init.d/functions.sh +find_unpackable_file() { echo "$@"; } +debug-print() { :; } +emktemp() { mktemp "$@"; } +alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || die' + +# Straight copied from eutils.eclass ... should be kept in sync +unpack_makeself() { + local src_input=${1:-${A}} + local src=$(find_unpackable_file "${src_input}") + local skip=$2 + local exe=$3 + + [[ -z ${src} ]] && die "Could not locate source for '${src_input}'" + + local shrtsrc=$(basename "${src}") + echo ">>> Unpacking ${shrtsrc} to ${PWD}" + if [[ -z ${skip} ]] ; then + local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}') + local skip=0 + exe=tail + case ${ver} in + 1.5.*|1.6.0-nv) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same + skip=$(grep -a ^skip= "${src}" | cut -d= -f2) + ;; + 2.0|2.0.1) + skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-) + ;; + 2.1.1) + skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-) + let skip="skip + 1" + ;; + 2.1.2) + skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1) + let skip="skip + 1" + ;; + 2.1.3) + skip=`grep -a ^offset= "${src}" | awk '{print $3}'` + let skip="skip + 1" + ;; + 2.1.4|2.1.5) + skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1) + 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}'." + eerror "Please file a bug about the file ${shrtsrc} at" + eerror "http://bugs.gentoo.org/ so that support can be added." + die "makeself version '${ver}' not supported" + ;; + esac + debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" + fi + case ${exe} in + tail) exe="tail -n +${skip} '${src}'";; + dd) exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";; + *) die "makeself cant handle exe '${exe}'" + esac + + # lets grab the first few bytes of the file to figure out what kind of archive it is + local tmpfile=$(emktemp) + eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" + local filetype=$(file -b "${tmpfile}") + case ${filetype} in + *tar\ archive*) + eval ${exe} | tar --no-same-owner -xf - + ;; + bzip2*) + eval ${exe} | bzip2 -dc | tar --no-same-owner -xf - + ;; + gzip*) + eval ${exe} | tar --no-same-owner -xzf - + ;; + compress*) + eval ${exe} | gunzip | tar --no-same-owner -xf - + ;; + *) + eerror "Unknown filetype \"${filetype}\" ?" + false + ;; + esac + assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" +} + +for x; do unpack_makeself "$x" ; done diff --git a/app-arch/makeself/makeself-2.1.5.ebuild b/app-arch/makeself/makeself-2.1.5.ebuild index 4d66b0ce17c1..b0f5d908cc3b 100644 --- a/app-arch/makeself/makeself-2.1.5.ebuild +++ b/app-arch/makeself/makeself-2.1.5.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-arch/makeself/makeself-2.1.5.ebuild,v 1.7 2008/09/29 01:52:54 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-arch/makeself/makeself-2.1.5.ebuild,v 1.8 2009/02/26 19:27:42 vapier Exp $ inherit eutils @@ -13,9 +13,6 @@ SLOT="0" KEYWORDS="amd64 hppa ppc s390 x86" IUSE="" -DEPEND="" -RDEPEND="" - S=${WORKDIR} src_unpack() { @@ -23,7 +20,7 @@ src_unpack() { } src_install() { - dobin makeself-header.sh makeself.sh || die + dobin makeself-header.sh makeself.sh "${FILESDIR}"/makeself-unpack || die doman makeself.1 dodoc README TODO makeself.lsm } |