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

Diff of /eclass/eutils.eclass

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

Revision 1.200 Revision 1.204
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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.200 2005/09/23 20:44:26 wolf31o2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.204 2005/10/07 04:15:20 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.
418 *) # Numeric 418 *) # Numeric
419 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" 419 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
420 ;; 420 ;;
421 esac 421 esac
422 elif [[ "${USERLAND}" == "BSD" ]] ; then 422 elif [[ "${USERLAND}" == "BSD" ]] ; then
423 local action 423 local opts action="user"
424 if [ "$1" == "passwd" ] 424 [[ $1 == "passwd" ]] || action="group"
425 then 425
426 action="user" 426 # lookup by uid/gid
427 else 427 if [[ $2 == [[:digit:]]* ]] ; then
428 action="group" 428 [[ ${action} == "user" ]] && opts="-u" || opts="-g"
429 fi 429 fi
430
430 pw show "${action}" "$2" -q 431 pw show ${action} ${opts} "$2" -q
431 else 432 else
432 which nscd >& /dev/null && nscd -i "$1" 433 which nscd >& /dev/null && nscd -i "$1"
433 getent "$1" "$2" 434 getent "$1" "$2"
434 fi 435 fi
435} 436}
492 if [[ ! -e ${eshell} ]] ; then 493 if [[ ! -e ${eshell} ]] ; then
493 eerror "A shell was specified but it does not exist !" 494 eerror "A shell was specified but it does not exist !"
494 die "${eshell} does not exist" 495 die "${eshell} does not exist"
495 fi 496 fi
496 else 497 else
497 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null; do 498 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do
498 [[ -x ${ROOT}${shell} ]] && break; 499 [[ -x ${ROOT}${shell} ]] && break
499 done 500 done
500 501
501 if [[ ${shell} == "/dev/null" ]]; then 502 if [[ ${shell} == "/dev/null" ]] ; then
502 eerror "Unable to identify the shell to use" 503 eerror "Unable to identify the shell to use"
503 die "Unable to identify the shell to use" 504 die "Unable to identify the shell to use"
504 fi 505 fi
505 506
506 eshell=${shell} 507 eshell=${shell}
855Exec=${exec} 856Exec=${exec}
856Path=${path} 857Path=${path}
857Icon=${icon} 858Icon=${icon}
858Categories=Application;${type};" > "${desktop}" 859Categories=Application;${type};" > "${desktop}"
859 860
861 (
862 # wrap the env here so that the 'insinto' call
863 # doesn't corrupt the env of the caller
860 insinto /usr/share/applications 864 insinto /usr/share/applications
861 doins "${desktop}" 865 doins "${desktop}"
862 866 )
863 return 0
864} 867}
865 868
866# Make a GDM/KDM Session file 869# Make a GDM/KDM Session file
867# 870#
868# make_desktop_entry(<title>, <command>) 871# make_desktop_entry(<title>, <command>)
1582# $4 == extra LD_LIBRARY_PATH's (make it : delimited) 1585# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1583# $5 == path for wrapper 1586# $5 == path for wrapper
1584make_wrapper() { 1587make_wrapper() {
1585 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5 1588 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
1586 local tmpwrapper=$(emktemp) 1589 local tmpwrapper=$(emktemp)
1590 # We don't want to quote ${bin} so that people can pass complex
1591 # things as $bin ... "./someprog --args"
1587 cat << EOF > "${tmpwrapper}" 1592 cat << EOF > "${tmpwrapper}"
1588#!/bin/sh 1593#!/bin/sh
1589cd "${chdir}" 1594cd "${chdir:-.}"
1595if [ "\${LD_LIBRARY_PATH+set}" = "set" ] && [ -n "${libdir}" ] ; then
1590export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}" 1596 export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1597fi
1591exec ${bin} "\$@" 1598exec ${bin} "\$@"
1592EOF 1599EOF
1593 chmod go+rx "${tmpwrapper}" 1600 chmod go+rx "${tmpwrapper}"
1594 if [ -n "${5}" ] 1601 if [[ -n ${path} ]] ; then
1595 then
1596 exeinto ${5} 1602 exeinto "${path}"
1597 newexe "${tmpwrapper}" "${wrapper}" 1603 newexe "${tmpwrapper}" "${wrapper}"
1598 else 1604 else
1599 newbin "${tmpwrapper}" "${wrapper}" 1605 newbin "${tmpwrapper}" "${wrapper}"
1600 fi 1606 fi
1601} 1607}

Legend:
Removed from v.1.200  
changed lines
  Added in v.1.204

  ViewVC Help
Powered by ViewVC 1.1.20