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

Diff of /eclass/eutils.eclass

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

Revision 1.35 Revision 1.39
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.35 2003/06/22 05:44:04 drobbins Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.39 2003/07/01 02:03:26 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.
549 fi 549 fi
550 einfo " - Groups: ${egroups}" 550 einfo " - Groups: ${egroups}"
551 551
552 # handle extra and add the user 552 # handle extra and add the user
553 local eextra="$@" 553 local eextra="$@"
554 local oldsandbox="${oldsandbox}" 554 local oldsandbox=${SANDBOX_ON}
555 export SANDBOX_ON="0" 555 export SANDBOX_ON="0"
556 if [ -z "${eextra}" ] ; then 556 if [ -z "${eextra}" ] ; then
557 useradd ${opts} ${euser} \ 557 useradd ${opts} ${euser} \
558 -c "added by portage for ${PN}" \ 558 -c "added by portage for ${PN}" \
559 || die "enewuser failed" 559 || die "enewuser failed"
565 export SANDBOX_ON="${oldsandbox}" 565 export SANDBOX_ON="${oldsandbox}"
566 566
567 if [ ! -e ${ehome} ] && [ ! -e ${D}/${ehome} ] ; then 567 if [ ! -e ${ehome} ] && [ ! -e ${D}/${ehome} ] ; then
568 einfo " - Creating ${ehome} in ${D}" 568 einfo " - Creating ${ehome} in ${D}"
569 dodir ${ehome} 569 dodir ${ehome}
570 fperms ${euser} ${ehome} 570 fowners ${euser} ${ehome}
571 fperms 755 ${ehome}
571 fi 572 fi
572} 573}
573 574
574# Simplify/standardize adding groups to the system 575# Simplify/standardize adding groups to the system
575# vapier@gentoo.org 576# vapier@gentoo.org
621 # handle extra 622 # handle extra
622 local eextra="$@" 623 local eextra="$@"
623 opts="${opts} ${eextra}" 624 opts="${opts} ${eextra}"
624 625
625 # add the group 626 # add the group
626 local oldsandbox="${oldsandbox}" 627 local oldsandbox=${SANDBOX_ON}
627 export SANDBOX_ON="0" 628 export SANDBOX_ON="0"
628 groupadd ${opts} ${egroup} || die "enewgroup failed" 629 groupadd ${opts} ${egroup} || die "enewgroup failed"
629 export SANDBOX_ON="${oldsandbox}" 630 export SANDBOX_ON="${oldsandbox}"
630} 631}
631 632
636edos2unix() { 637edos2unix() {
637 for f in $@ ; do 638 for f in $@ ; do
638 cp ${f} ${T}/edos2unix 639 cp ${f} ${T}/edos2unix
639 sed 's/\r$//' ${T}/edos2unix > ${f} 640 sed 's/\r$//' ${T}/edos2unix > ${f}
640 done 641 done
642}
643
644# Make a desktop file !
645# Great for making those icons in kde/gnome startmenu !
646# Amaze your friends ! Get the women ! Join today !
647# gnome2 /usr/share/applications
648# gnome1 /usr/share/gnome/apps/
649# KDE ${KDEDIR}/share/applnk /usr/share/applnk
650#
651# make_desktop_entry(<binary>, [name], [icon], [type], [path])
652#
653# binary: what binary does the app run with ?
654# name: the name that will show up in the menu
655# icon: give your little like a pretty little icon ...
656# this can be relative (to /usr/share/pixmaps) or
657# a full path to an icon
658# type: what kind of application is this ? for categories:
659# http://www.freedesktop.org/standards/menu/draft/menu-spec/menu-spec.html
660# path: if your app needs to startup in a specific dir
661make_desktop_entry() {
662 [ -z "$1" ] && eerror "You must specify the executable" && return 1
663
664 local exec=${1}
665 local name=${2:-${PN}}
666 local icon=${3:-${PN}.png}
667 local type=${4}
668 local path=${5:-${GAMES_PREFIX}}
669 if [ -z "${type}" ] ; then
670 case ${CATEGORY} in
671 app-emulation) type=Emulator ;;
672 app-games) type=Game ;;
673 *) type="" ;;
674 esac
675 fi
676
677echo "[Desktop Entry]
678Encoding=UTF-8
679Version=0.9.2
680Name=${name}
681Type=Application
682Comment=${DESCRIPTION}
683Exec=${exec}
684Path=${path}
685Icon=${icon}
686Categories=Application;${type};" > ${T}/${name}.desktop
687 name=${T}/${name}.desktop
688
689 if [ -d /usr/share/applications ] ; then
690 insinto /usr/share/applications
691 doins ${name}
692 fi
693
694 if [ -d /usr/share/gnome/apps ] ; then
695 insinto /usr/share/gnome/apps/Games
696 doins ${name}
697 fi
698
699 if [ ! -z "`ls /usr/kde/* 2>/dev/null`" ] ; then
700 for ver in /usr/kde/* ; do
701 insinto ${ver}/share/applnk/Games
702 doins ${name}
703 done
704 fi
705
706 if [ -d /usr/share/applnk ] ; then
707 insinto /usr/share/applnk
708 doins ${name}
709 fi
710
711 return 0
641} 712}
642 713
643# new convenience patch wrapper function to eventually replace epatch(), 714# new convenience patch wrapper function to eventually replace epatch(),
644# $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and 715# $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and
645# /usr/bin/patch 716# /usr/bin/patch

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.20