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

Diff of /eclass/eutils.eclass

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

Revision 1.67 Revision 1.69
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.67 2003/11/18 18:45:04 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.69 2003/11/26 22:13:35 mr_bones_ 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.
962 ;; 962 ;;
963 esac 963 esac
964 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" 964 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
965 fi 965 fi
966 966
967 # we do this because otherwise a failure in gzip will cause 0 bytes to be sent 967 # lets grab the first few bytes of the file to figure out what kind of archive it is
968 # to tar which will make tar not extract anything and exit with 0 968 local tmpfile="`mymktemp ${T}`"
969 tail -n +${skip} ${src} 2>/dev/null \ 969 tail -n +${skip} ${src} 2>/dev/null | head -c 512 > ${tmpfile}
970 | gzip -cd 2>/dev/null \ 970 local filetype="`file -b ${tmpfile}`"
971 | tar -x --no-same-owner -f - 2>/dev/null 971 case ${filetype} in
972 local pipestatus="${PIPESTATUS[*]}" 972 *tar\ archive)
973 pipestatus="${pipestatus// }" 973 tail -n +${skip} ${src} | tar -xf -
974 if [ "${pipestatus//0}" != "" ] 974 ;;
975 then 975 bzip2*)
976 # maybe it isnt gzipped ... they usually are, but not always ... 976 tail -n +${skip} ${src} | bzip2 -dc | tar -xf -
977 tail -n +${skip} ${src} 2>/dev/null \ 977 ;;
978 | tar -x --no-same-owner -f - 2>/dev/null 978 gzip*)
979 pipestatus="${pipestatus// }" 979 tail -n +${skip} ${src} | tar -xzf -
980 if [ "${pipestatus//0}" != "" ] 980 ;;
981 then 981 *)
982 # and every once in a while they are bzipped2 ... 982 false
983 tail -n +${skip} ${src} 2>/dev/null \ 983 ;;
984 | bunzip2 -c 2>/dev/null \ 984 esac
985 | tar -x --no-same-owner -f - 2>/dev/null \
986 || die "failure unpacking makeself ${shrtsrc} ('${ver}' +${skip})" 985 assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})"
987 fi
988 fi
989} 986}
990 987
991# Display a license for user to accept. 988# Display a license for user to accept.
992# 989#
993# Usage: check_license [license] 990# Usage: check_license [license]

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.69

  ViewVC Help
Powered by ViewVC 1.1.20