| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 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/eutils.eclass,v 1.343 2010/05/11 20:08:02 mr_bones_ Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.344 2010/05/20 02:21:17 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: eutils.eclass |
5 | # @ECLASS: eutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
| … | |
… | |
| 1339 | 2.0|2.0.1) |
1339 | 2.0|2.0.1) |
| 1340 | skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-) |
1340 | skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-) |
| 1341 | ;; |
1341 | ;; |
| 1342 | 2.1.1) |
1342 | 2.1.1) |
| 1343 | skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-) |
1343 | skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-) |
| 1344 | let skip="skip + 1" |
1344 | (( skip++ )) |
| 1345 | ;; |
1345 | ;; |
| 1346 | 2.1.2) |
1346 | 2.1.2) |
| 1347 | skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1) |
1347 | skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1) |
| 1348 | let skip="skip + 1" |
1348 | (( skip++ )) |
| 1349 | ;; |
1349 | ;; |
| 1350 | 2.1.3) |
1350 | 2.1.3) |
| 1351 | skip=`grep -a ^offset= "${src}" | awk '{print $3}'` |
1351 | skip=`grep -a ^offset= "${src}" | awk '{print $3}'` |
| 1352 | let skip="skip + 1" |
1352 | (( skip++ )) |
| 1353 | ;; |
1353 | ;; |
| 1354 | 2.1.4|2.1.5) |
1354 | 2.1.4|2.1.5) |
| 1355 | skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1) |
1355 | skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1) |
| 1356 | skip=$(head -n ${skip} "${src}" | wc -c) |
1356 | skip=$(head -n ${skip} "${src}" | wc -c) |
| 1357 | exe="dd" |
1357 | exe="dd" |
| … | |
… | |
| 1366 | esac |
1366 | esac |
| 1367 | debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" |
1367 | debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" |
| 1368 | fi |
1368 | fi |
| 1369 | case ${exe} in |
1369 | case ${exe} in |
| 1370 | tail) exe="tail -n +${skip} '${src}'";; |
1370 | tail) exe="tail -n +${skip} '${src}'";; |
| 1371 | dd) exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";; |
1371 | dd) exe="dd ibs=${skip} skip=1 if='${src}'";; |
| 1372 | *) die "makeself cant handle exe '${exe}'" |
1372 | *) die "makeself cant handle exe '${exe}'" |
| 1373 | esac |
1373 | esac |
| 1374 | |
1374 | |
| 1375 | # lets grab the first few bytes of the file to figure out what kind of archive it is |
1375 | # lets grab the first few bytes of the file to figure out what kind of archive it is |
| 1376 | local tmpfile=$(emktemp) |
1376 | local tmpfile=$(emktemp) |