| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2006 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.256 2006/10/31 19:29:12 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.258 2006/11/02 21:13:47 nyhm Exp $ |
| 4 | # |
4 | # |
| 5 | # This eclass is for general purpose functions that most ebuilds |
5 | # This eclass is for general purpose functions that most ebuilds |
| 6 | # have to implement themselves. |
6 | # have to implement themselves. |
| 7 | # |
7 | # |
| 8 | # NB: If you add anything, please comment it! |
8 | # NB: If you add anything, please comment it! |
| … | |
… | |
| 1163 | # lets grab the first few bytes of the file to figure out what kind of archive it is |
1163 | # lets grab the first few bytes of the file to figure out what kind of archive it is |
| 1164 | local tmpfile="$(emktemp)" |
1164 | local tmpfile="$(emktemp)" |
| 1165 | eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" |
1165 | eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" |
| 1166 | local filetype="$(file -b "${tmpfile}")" |
1166 | local filetype="$(file -b "${tmpfile}")" |
| 1167 | case ${filetype} in |
1167 | case ${filetype} in |
| 1168 | *tar\ archive) |
1168 | *tar\ archive*) |
| 1169 | eval ${exe} | tar --no-same-owner -xf - |
1169 | eval ${exe} | tar --no-same-owner -xf - |
| 1170 | ;; |
1170 | ;; |
| 1171 | bzip2*) |
1171 | bzip2*) |
| 1172 | eval ${exe} | bzip2 -dc | tar --no-same-owner -xf - |
1172 | eval ${exe} | bzip2 -dc | tar --no-same-owner -xf - |
| 1173 | ;; |
1173 | ;; |
| … | |
… | |
| 1402 | |
1402 | |
| 1403 | while [[ -n ${cdset[${i}]} ]] ; do |
1403 | while [[ -n ${cdset[${i}]} ]] ; do |
| 1404 | local dir=$(dirname ${cdset[${i}]}) |
1404 | local dir=$(dirname ${cdset[${i}]}) |
| 1405 | local file=$(basename ${cdset[${i}]}) |
1405 | local file=$(basename ${cdset[${i}]}) |
| 1406 | |
1406 | |
| 1407 | for mline in $(mount | gawk '/(iso|cdrom|fs=cdfss)/ {print $3}') ; do |
1407 | for mline in $(gawk '/(iso|cdrom|fs=cdfss)/ {print $2}' /proc/mounts) ; do |
|
|
1408 | mline=$(echo -e ${mline}) |
| 1408 | [[ -d ${mline}/${dir} ]] || continue |
1409 | [[ -d ${mline}/${dir} ]] || continue |
| 1409 | if [[ -n $(find ${mline}/${dir} -maxdepth 1 -iname ${file}) ]] ; then |
1410 | if [[ -n $(find "${mline}"/${dir} -maxdepth 1 -iname ${file}) ]] ; then |
| 1410 | export CDROM_ROOT=${mline} |
1411 | export CDROM_ROOT=${mline} |
| 1411 | export CDROM_SET=${i} |
1412 | export CDROM_SET=${i} |
| 1412 | export CDROM_MATCH=${cdset[${i}]} |
1413 | export CDROM_MATCH=${cdset[${i}]} |
| 1413 | return |
1414 | return |
| 1414 | fi |
1415 | fi |