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

Diff of /eclass/eutils.eclass

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

Revision 1.130 Revision 1.131
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.130 2004/12/24 07:16:14 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.131 2004/12/26 07:09:59 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.
1258 export CDROM_TOTAL_CDS=${cdcnt} 1258 export CDROM_TOTAL_CDS=${cdcnt}
1259 export CDROM_CURRENT_CD=1 1259 export CDROM_CURRENT_CD=1
1260 1260
1261 # now we see if the user gave use CD_ROOT ... 1261 # now we see if the user gave use CD_ROOT ...
1262 # if they did, let's just believe them that it's correct 1262 # if they did, let's just believe them that it's correct
1263 if [ ! -z "${CD_ROOT}" ] ; then 1263 if [[ ! -z ${CD_ROOT} ]] ; then
1264 export CDROM_ROOT="${CD_ROOT}" 1264 export CDROM_ROOT=${CD_ROOT}
1265 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1265 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1266 return 1266 return
1267 fi 1267 fi
1268 # do the same for CD_ROOT_X 1268 # do the same for CD_ROOT_X
1269 if [ ! -z "${CD_ROOT_1}" ] ; then 1269 if [[ ! -z ${CD_ROOT_1} ]] ; then
1270 local var= 1270 local var=
1271 cdcnt=0 1271 cdcnt=0
1272 while [ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ] ; do 1272 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1273 cdcnt=$((cdcnt + 1)) 1273 cdcnt=$((cdcnt + 1))
1274 var="CD_ROOT_${cdcnt}" 1274 var="CD_ROOT_${cdcnt}"
1275 if [ -z "${!var}" ] ; then 1275 if [[ -z ${!var} ]] ; then
1276 eerror "You must either use just the CD_ROOT" 1276 eerror "You must either use just the CD_ROOT"
1277 eerror "or specify ALL the CD_ROOT_X variables." 1277 eerror "or specify ALL the CD_ROOT_X variables."
1278 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables." 1278 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables."
1279 die "could not locate CD_ROOT_${cdcnt}" 1279 die "could not locate CD_ROOT_${cdcnt}"
1280 fi 1280 fi
1283 export CDROM_ROOT=${CDROM_ROOTS_1} 1283 export CDROM_ROOT=${CDROM_ROOTS_1}
1284 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1284 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1285 return 1285 return
1286 fi 1286 fi
1287 1287
1288 if [ ${CDROM_TOTAL_CDS} -eq 1 ] ; then 1288 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
1289 einfon "This ebuild will need the " 1289 einfon "This ebuild will need the "
1290 if [ -z "${CDROM_NAME}" ] ; then 1290 if [[ -z ${CDROM_NAME} ]] ; then
1291 echo "cdrom for ${PN}." 1291 echo "cdrom for ${PN}."
1292 else 1292 else
1293 echo "${CDROM_NAME}." 1293 echo "${CDROM_NAME}."
1294 fi 1294 fi
1295 echo 1295 echo
1299 einfo "directory containing the files." 1299 einfo "directory containing the files."
1300 echo 1300 echo
1301 else 1301 else
1302 einfo "This package will need access to ${CDROM_TOTAL_CDS} cds." 1302 einfo "This package will need access to ${CDROM_TOTAL_CDS} cds."
1303 cdcnt=0 1303 cdcnt=0
1304 while [ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ] ; do 1304 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1305 cdcnt=$((cdcnt + 1)) 1305 cdcnt=$((cdcnt + 1))
1306 var="CDROM_NAME_${cdcnt}" 1306 var="CDROM_NAME_${cdcnt}"
1307 [ ! -z "${!var}" ] && einfo " CD ${cdcnt}: ${!var}" 1307 [[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}"
1308 done 1308 done
1309 echo 1309 echo
1310 einfo "If you do not have the CDs, but have the data files" 1310 einfo "If you do not have the CDs, but have the data files"
1311 einfo "mounted somewhere on your filesystem, just export" 1311 einfo "mounted somewhere on your filesystem, just export"
1312 einfo "the following variables so they point to the right place:" 1312 einfo "the following variables so they point to the right place:"
1313 einfon "" 1313 einfon ""
1314 cdcnt=0 1314 cdcnt=0
1315 while [ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ] ; do 1315 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1316 cdcnt=$((cdcnt + 1)) 1316 cdcnt=$((cdcnt + 1))
1317 echo -n " CD_ROOT_${cdcnt}" 1317 echo -n " CD_ROOT_${cdcnt}"
1318 done 1318 done
1319 echo 1319 echo
1320 einfo "Or, if you have all the files in the same place, or" 1320 einfo "Or, if you have all the files in the same place, or"
1333# remember, you can only go forward in the cd chain, you can't go back. 1333# remember, you can only go forward in the cd chain, you can't go back.
1334cdrom_load_next_cd() { 1334cdrom_load_next_cd() {
1335 export CDROM_CURRENT_CD=$((CDROM_CURRENT_CD + 1)) 1335 export CDROM_CURRENT_CD=$((CDROM_CURRENT_CD + 1))
1336 local var= 1336 local var=
1337 1337
1338 if [ ! -z "${CD_ROOT}" ] ; then 1338 if [[ ! -z ${CD_ROOT} ]] ; then
1339 einfo "Using same root as before for CD #${CDROM_CURRENT_CD}" 1339 einfo "Using same root as before for CD #${CDROM_CURRENT_CD}"
1340 return 1340 return
1341 fi 1341 fi
1342 1342
1343 unset CDROM_ROOT 1343 unset CDROM_ROOT
1344 var=CDROM_ROOTS_${CDROM_CURRENT_CD} 1344 var=CDROM_ROOTS_${CDROM_CURRENT_CD}
1345 if [ -z "${!var}" ] ; then 1345 if [[ -z ${!var} ]] ; then
1346 var="CDROM_CHECK_${CDROM_CURRENT_CD}" 1346 var="CDROM_CHECK_${CDROM_CURRENT_CD}"
1347 cdrom_locate_file_on_cd ${!var} 1347 cdrom_locate_file_on_cd ${!var}
1348 else 1348 else
1349 export CDROM_ROOT="${!var}" 1349 export CDROM_ROOT=${!var}
1350 fi 1350 fi
1351 1351
1352 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1352 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1353} 1353}
1354 1354
1358# found, then a message asking for the user to insert the cdrom will be 1358# found, then a message asking for the user to insert the cdrom will be
1359# displayed and we'll hang out here until: 1359# displayed and we'll hang out here until:
1360# (1) the file is found on a mounted cdrom 1360# (1) the file is found on a mounted cdrom
1361# (2) the user hits CTRL+C 1361# (2) the user hits CTRL+C
1362cdrom_locate_file_on_cd() { 1362cdrom_locate_file_on_cd() {
1363 while [ -z "${CDROM_ROOT}" ] ; do 1363 while [[ -z ${CDROM_ROOT} ]] ; do
1364 local dir="$(dirname ${@})" 1364 local dir="$(dirname ${@})"
1365 local file="$(basename ${@})" 1365 local file="$(basename ${@})"
1366 local mline="" 1366 local mline=""
1367 local showedmsg=0 1367 local showedmsg=0
1368 1368
1369 for mline in `mount | egrep -e '(iso|cdrom)' | awk '{print $3}'` ; do 1369 for mline in $(mount | egrep -e '(iso|cdrom)' | awk '{print $3}') ; do
1370 [ -d "${mline}/${dir}" ] || continue 1370 [[ -d ${mline}/${dir} ]] || continue
1371 [ ! -z "$(find ${mline}/${dir} -iname ${file} -maxdepth 1)" ] \ 1371 [[ ! -z $(find ${mline}/${dir} -iname ${file} -maxdepth 1) ]] \
1372 && export CDROM_ROOT=${mline} 1372 && export CDROM_ROOT=${mline}
1373 done 1373 done
1374 1374
1375 if [ -z "${CDROM_ROOT}" ] ; then 1375 if [[ -z ${CDROM_ROOT} ]] ; then
1376 echo 1376 echo
1377 if [ ${showedmsg} -eq 0 ] ; then 1377 if [[ ${showedmsg} -eq 0 ]] ; then
1378 if [ ${CDROM_TOTAL_CDS} -eq 1 ] ; then 1378 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
1379 if [ -z "${CDROM_NAME}" ] ; then 1379 if [[ -z ${CDROM_NAME} ]] ; then
1380 einfo "Please insert the cdrom for ${PN} now !" 1380 einfo "Please insert the cdrom for ${PN} now !"
1381 else 1381 else
1382 einfo "Please insert the ${CDROM_NAME} cdrom now !" 1382 einfo "Please insert the ${CDROM_NAME} cdrom now !"
1383 fi 1383 fi
1384 else 1384 else
1385 if [ -z "${CDROM_NAME_1}" ] ; then 1385 if [[ -z ${CDROM_NAME_1} ]] ; then
1386 einfo "Please insert cd #${CDROM_CURRENT_CD} for ${PN} now !" 1386 einfo "Please insert cd #${CDROM_CURRENT_CD} for ${PN} now !"
1387 else 1387 else
1388 local var="CDROM_NAME_${CDROM_CURRENT_CD}" 1388 local var="CDROM_NAME_${CDROM_CURRENT_CD}"
1389 einfo "Please insert+mount the ${!var} cdrom now !" 1389 einfo "Please insert+mount the ${!var} cdrom now !"
1390 fi 1390 fi

Legend:
Removed from v.1.130  
changed lines
  Added in v.1.131

  ViewVC Help
Powered by ViewVC 1.1.20