| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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.313 2009/02/18 20:17:18 betelgeuse Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.315 2009/02/21 23:28:21 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: eutils.eclass |
5 | # @ECLASS: eutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
| … | |
… | |
| 969 | einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo." |
969 | einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo." |
| 970 | fi |
970 | fi |
| 971 | } |
971 | } |
| 972 | |
972 | |
| 973 | # @FUNCTION: make_session_desktop |
973 | # @FUNCTION: make_session_desktop |
| 974 | # @USAGE: <title> <command> |
974 | # @USAGE: <title> <command> [command args...] |
| 975 | # @DESCRIPTION: |
975 | # @DESCRIPTION: |
| 976 | # Make a GDM/KDM Session file. The title is the file to execute to start the |
976 | # Make a GDM/KDM Session file. The title is the file to execute to start the |
| 977 | # Window Manager. The command is the name of the Window Manager. |
977 | # Window Manager. The command is the name of the Window Manager. |
|
|
978 | # |
|
|
979 | # You can set the name of the file via the ${wm} variable. |
| 978 | make_session_desktop() { |
980 | make_session_desktop() { |
| 979 | [[ -z $1 ]] && eerror "make_session_desktop: You must specify the title" && return 1 |
981 | [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1 |
| 980 | [[ -z $2 ]] && eerror "make_session_desktop: You must specify the command" && return 1 |
982 | [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1 |
| 981 | |
983 | |
| 982 | local title=$1 |
984 | local title=$1 |
| 983 | local command=$2 |
985 | local command=$2 |
| 984 | local desktop=${T}/${wm}.desktop |
986 | local desktop=${T}/${wm:-${PN}}.desktop |
|
|
987 | shift 2 |
| 985 | |
988 | |
| 986 | cat <<-EOF > "${desktop}" |
989 | cat <<-EOF > "${desktop}" |
| 987 | [Desktop Entry] |
990 | [Desktop Entry] |
| 988 | Name=${title} |
991 | Name=${title} |
| 989 | Comment=This session logs you into ${title} |
992 | Comment=This session logs you into ${title} |
| 990 | Exec=${command} |
993 | Exec=${command} $* |
| 991 | TryExec=${command} |
994 | TryExec=${command} |
| 992 | Type=Application |
995 | Type=XSession |
| 993 | EOF |
996 | EOF |
| 994 | |
997 | |
| 995 | ( |
998 | ( |
| 996 | # wrap the env here so that the 'insinto' call |
999 | # wrap the env here so that the 'insinto' call |
| 997 | # doesn't corrupt the env of the caller |
1000 | # doesn't corrupt the env of the caller |
| … | |
… | |
| 1580 | # of the lists. |
1583 | # of the lists. |
| 1581 | strip-linguas() { |
1584 | strip-linguas() { |
| 1582 | local ls newls nols |
1585 | local ls newls nols |
| 1583 | if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
1586 | if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
| 1584 | local op=$1; shift |
1587 | local op=$1; shift |
| 1585 | ls=$(find "$1" -name '*.po' -exec basename {} .po \;); shift |
1588 | ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift |
| 1586 | local d f |
1589 | local d f |
| 1587 | for d in "$@" ; do |
1590 | for d in "$@" ; do |
| 1588 | if [[ ${op} == "-u" ]] ; then |
1591 | if [[ ${op} == "-u" ]] ; then |
| 1589 | newls=${ls} |
1592 | newls=${ls} |
| 1590 | else |
1593 | else |
| 1591 | newls="" |
1594 | newls="" |
| 1592 | fi |
1595 | fi |
| 1593 | for f in $(find "$d" -name '*.po' -exec basename {} .po \;) ; do |
1596 | for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do |
| 1594 | if [[ ${op} == "-i" ]] ; then |
1597 | if [[ ${op} == "-i" ]] ; then |
| 1595 | hasq ${f} ${ls} && newls="${newls} ${f}" |
1598 | hasq ${f} ${ls} && newls="${newls} ${f}" |
| 1596 | else |
1599 | else |
| 1597 | hasq ${f} ${ls} || newls="${newls} ${f}" |
1600 | hasq ${f} ${ls} || newls="${newls} ${f}" |
| 1598 | fi |
1601 | fi |