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

Diff of /eclass/eutils.eclass

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

Revision 1.118 Revision 1.119
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.118 2004/10/13 14:33:01 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.119 2004/10/14 22:44:18 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.
543# does not exist on the users system 543# does not exist on the users system
544# vapier@gentoo.org 544# vapier@gentoo.org
545# 545#
546# Takes just 1 optional parameter (the directory to create tmpfile in) 546# Takes just 1 optional parameter (the directory to create tmpfile in)
547emktemp() { 547emktemp() {
548 local exe="touch"
549 [ "$1" == "-d" ] && exe="mkdir" && shift
548 local topdir="$1" 550 local topdir="$1"
549 551
550 if [ -z "${topdir}" ] 552 if [ -z "${topdir}" ]
551 then 553 then
552 [ -z "${T}" ] \ 554 [ -z "${T}" ] \
558 then 560 then
559 local tmp=/ 561 local tmp=/
560 while [ -e "${tmp}" ] ; do 562 while [ -e "${tmp}" ] ; do
561 tmp="${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}" 563 tmp="${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}"
562 done 564 done
563 touch "${tmp}" 565 ${exe} "${tmp}"
564 echo "${tmp}" 566 echo "${tmp}"
565 else 567 else
568 [ "${exe}" == "touch" ] \
569 && exe="-p" \
570 || exe="-d"
566 mktemp -p "${topdir}" 571 mktemp ${exe} "${topdir}"
567 fi 572 fi
568} 573}
569 574
570# Small wrapper for getent (Linux), nidump (Mac OS X), 575# Small wrapper for getent (Linux), nidump (Mac OS X),
571# and pw (FreeBSD) used in enewuser()/enewgroup() 576# and pw (FreeBSD) used in enewuser()/enewgroup()

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.119

  ViewVC Help
Powered by ViewVC 1.1.20