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

Diff of /eclass/eutils.eclass

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

Revision 1.40 Revision 1.41
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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/eutils.eclass,v 1.40 2003/07/02 23:01:08 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.41 2003/07/14 04:47:17 vapier Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
826 eend $? 826 eend $?
827 827
828 done 828 done
829 829
830} 830}
831
832# Unpack those pesky makeself generated files ...
833# They're shell scripts with the binary package tagged onto
834# the end of the archive. Loki utilized the format as does
835# many other game companies.
836#
837# Usage: unpack_makeself [file to unpack] [offset]
838# - If the file is not specified then unpack will utilize ${A}.
839# - If the offset is not specified then we will attempt to extract
840# the proper offset from the script itself.
841unpack_makeself() {
842 local src=$1
843 local skip=$2
844
845 [ -z "${src}" ] && src=${A}
846 [ -e ./${src} ] \
847 && src=${PWD}/${src} \
848 || src=${DISTDIR}/${src}
849 local shrtsrc=`basename ${src}`
850 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
851 if [ -z "${skip}" ] ; then
852 local ver="`grep -a '#.*Makeself' ${src} | awk '{print $NF}'`"
853 local skip=0
854 case ${ver} in
855 1.5.*) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same
856 skip=`grep -a ^skip= ${src} | cut -d= -f2`
857 ;;
858 2.0|2.0.1)
859 skip=`grep -a ^$'\t'tail ${src} | awk '{print $2}' | cut -b2-`
860 ;;
861 2.1.1)
862 skip=`grep -a ^offset= ${src} | awk '{print $2}' | cut -b2-`
863 let skip="skip + 1"
864 ;;
865 *)
866 eerror "I'm sorry, but I was unable to support the Makeself file."
867 eerror "The version I detected was '${ver}'."
868 eerror "Please file a bug about the file ${shrtsrc} at"
869 eerror "http://bugs.gentoo.org/ so that support can be added."
870 die "makeself version '${ver}' not supported"
871 ;;
872 esac
873 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
874 fi
875
876 # we do this because otherwise a failure in gzip will cause 0 bytes to be sent
877 # to tar which will make tar not extract anything and exit with 0
878 local out="`tail +${skip} ${src} | gzip -cd | tar -x --no-same-owner -v -f -`"
879 [ -z "${out}" ] && die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})"
880}

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20