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

Diff of /eclass/eutils.eclass

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

Revision 1.143 Revision 1.163
1# Copyright 1999-2004 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.143 2005/01/26 16:19:12 ka0ttic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.163 2005/03/26 06:33:16 eradicator 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.
14INHERITED="$INHERITED $ECLASS" 14INHERITED="$INHERITED $ECLASS"
15 15
16DEPEND="!bootstrap? ( sys-devel/patch )" 16DEPEND="!bootstrap? ( sys-devel/patch )"
17 17
18DESCRIPTION="Based on the ${ECLASS} eclass" 18DESCRIPTION="Based on the ${ECLASS} eclass"
19
20# ecpu_check
21# Usage:
22#
23# ecpu_check array_of_cpu_flags
24#
25# array_of_cpu_flags - An array of cpu flags to check against USE flags
26#
27# Checks user USE related cpu flags against /proc/cpuinfo. If user enables a
28# cpu flag that is not supported in their processor flags, it will warn the
29# user if CROSSCOMPILE is not set to 1 ( because cross compile users are
30# obviously using different cpu flags than their own cpu ). Examples:
31#
32# CPU_FLAGS=(mmx mmx2 sse sse2)
33# ecpu_check CPU_FLAGS
34# Chris White <chriswhite@gentoo.org> (03 Feb 2005)
35
36ecpu_check() {
37 # Think about changing below to: if [ "${CROSSCOMPILE}" -ne 1 -a -e "/proc/cpuinfo" ]
38 # and dropping the else if you do not plan on adding anything to that
39 # empty block ....
40 # PS: also try to add some quoting, and consider rather using ${foo} than $foo ...
41 if [ "${CROSSCOMPILE}" != "1" -a -e "/proc/cpuinfo" ]
42 then
43 CPU_FLAGS=${1}
44 USER_CPU=`grep "flags" /proc/cpuinfo`
45
46 for flags in `seq 1 ${#CPU_FLAGS[@]}`
47 do
48 if has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && ! has ${CPU_FLAGS[${flags} - 1]} ${USE}
49 then
50 ewarn "Your system is ${CPU_FLAGS[${flags} - 1]} capable but you don't have it enabled!"
51 ewarn "You might be cross compiling (in this case set CROSSCOMPILE to 1 to disable this warning."
52 fi
53
54 if ! has ${CPU_FLAGS[${flags} - 1]} ${USER_CPU} && has ${CPU_FLAGS[${flags} -1]} ${USE}
55 then
56 ewarn "You have ${CPU_FLAGS[${flags} - 1]} support enabled but your processor doesn't"
57 ewarn "Seem to support it! You might be cross compiling or do not have /proc filesystem"
58 ewarn "enabled. If either is the case, set CROSSCOMPILE to 1 to disable this warning."
59 fi
60 done
61 fi
62}
19 63
20# Wait for the supplied number of seconds. If no argument is supplied, defaults 64# Wait for the supplied number of seconds. If no argument is supplied, defaults
21# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not 65# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not
22# outputting to a terminal, don't wait. For compatability purposes, the argument 66# outputting to a terminal, don't wait. For compatability purposes, the argument
23# must be an integer greater than zero. 67# must be an integer greater than zero.
65gen_usr_ldscript() { 109gen_usr_ldscript() {
66 local libdir="$(get_libdir)" 110 local libdir="$(get_libdir)"
67 # Just make sure it exists 111 # Just make sure it exists
68 dodir /usr/${libdir} 112 dodir /usr/${libdir}
69 113
114 for lib in "${@}" ; do
70 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 115 cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
71/* GNU ld script 116 /* GNU ld script
72 Because Gentoo have critical dynamic libraries 117 Since Gentoo has critical dynamic libraries
73 in /lib, and the static versions in /usr/lib, we 118 in /lib, and the static versions in /usr/lib,
74 need to have a "fake" dynamic lib in /usr/lib, 119 we need to have a "fake" dynamic lib in /usr/lib,
75 otherwise we run into linking problems. 120 otherwise we run into linking problems.
76 See bug #4411 on http://bugs.gentoo.org/ for 121
77 more info. */ 122 See bug http://bugs.gentoo.org/4411 for more info.
123 */
78GROUP ( /${libdir}/${1} ) 124 GROUP ( /${libdir}/${lib} )
79END_LDSCRIPT 125 END_LDSCRIPT
80 fperms a+x "/usr/${libdir}/${1}" 126 fperms a+x "/usr/${libdir}/${lib}"
127 done
81} 128}
82 129
83# Simple function to draw a line consisting of '=' the same length as $* 130# Simple function to draw a line consisting of '=' the same length as $*
84# 131#
85# <azarah@gentoo.org> (11 Nov 2002) 132# <azarah@gentoo.org> (11 Nov 2002)
248 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \ 295 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \
249 [ "${EPATCH_FORCE}" = "yes" ]) 296 [ "${EPATCH_FORCE}" = "yes" ])
250 then 297 then
251 local count=0 298 local count=0
252 local popts="${EPATCH_OPTS}" 299 local popts="${EPATCH_OPTS}"
300 local patchname=${x##*/}
253 301
254 if [ -n "${EPATCH_EXCLUDE}" ] 302 if [ -n "${EPATCH_EXCLUDE}" ]
255 then 303 then
256 if [ "`eval echo \$\{EPATCH_EXCLUDE/${x##*/}\}`" != "${EPATCH_EXCLUDE}" ] 304 if [ "${EPATCH_EXCLUDE/${patchname}}" != "${EPATCH_EXCLUDE}" ]
257 then 305 then
258 continue 306 continue
259 fi 307 fi
260 fi 308 fi
261 309
263 then 311 then
264 if [ -n "${EPATCH_SINGLE_MSG}" ] 312 if [ -n "${EPATCH_SINGLE_MSG}" ]
265 then 313 then
266 einfo "${EPATCH_SINGLE_MSG}" 314 einfo "${EPATCH_SINGLE_MSG}"
267 else 315 else
268 einfo "Applying ${x##*/} ..." 316 einfo "Applying ${patchname} ..."
269 fi 317 fi
270 else 318 else
271 einfo " ${x##*/} ..." 319 einfo " ${patchname} ..."
272 fi 320 fi
273 321
274 echo "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 322 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
275 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 323 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
276 324
277 # Allow for prefix to differ ... im lazy, so shoot me :/ 325 # Allow for prefix to differ ... im lazy, so shoot me :/
278 while [ "${count}" -lt 5 ] 326 while [ "${count}" -lt 5 ]
279 do 327 do
280 # Generate some useful debug info ... 328 # Generate some useful debug info ...
281 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 329 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
282 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 330 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
283 331
284 if [ "${PATCH_SUFFIX}" != "patch" ] 332 if [ "${PATCH_SUFFIX}" != "patch" ]
285 then 333 then
286 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 334 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
287 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 335 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
288 else 336 else
289 PATCH_TARGET="${x}" 337 PATCH_TARGET="${x}"
290 fi 338 fi
291 339
292 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 340 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
293 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 341 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
294 342
295 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 343 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
296 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 344 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
297 345
298 if [ "${PATCH_SUFFIX}" != "patch" ] 346 if [ "${PATCH_SUFFIX}" != "patch" ]
299 then 347 then
300 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 348 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
301 then 349 then
302 echo 350 echo
303 eerror "Could not extract patch!" 351 eerror "Could not extract patch!"
304 #die "Could not extract patch!" 352 #die "Could not extract patch!"
305 count=5 353 count=5
306 break 354 break
307 fi 355 fi
308 fi 356 fi
309 357
310 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 358 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
311 then 359 then
312 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 360 draw_line "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
313 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 361 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
314 echo "ACTUALLY APPLYING ${x##*/} ..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 362 echo "ACTUALLY APPLYING ${patchname} ..." >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
315 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 363 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
316 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 364 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
317 365
318 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1 366 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real 2>&1
319 367
320 if [ "$?" -ne 0 ] 368 if [ "$?" -ne 0 ]
321 then 369 then
322 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 370 cat ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
323 echo 371 echo
324 eerror "A dry-run of patch command succeeded, but actually" 372 eerror "A dry-run of patch command succeeded, but actually"
325 eerror "applying the patch failed!" 373 eerror "applying the patch failed!"
326 #die "Real world sux compared to the dreamworld!" 374 #die "Real world sux compared to the dreamworld!"
327 count=5 375 count=5
328 fi 376 fi
329 377
330 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 378 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
331 379
332 break 380 break
333 fi 381 fi
334 382
335 count=$((count + 1)) 383 count=$((count + 1))
341 fi 389 fi
342 390
343 if [ "${count}" -eq 5 ] 391 if [ "${count}" -eq 5 ]
344 then 392 then
345 echo 393 echo
346 eerror "Failed Patch: ${x##*/}!" 394 eerror "Failed Patch: ${patchname} !"
395 eerror " ( ${PATCH_TARGET} )"
347 eerror 396 eerror
348 eerror "Include in your bugreport the contents of:" 397 eerror "Include in your bugreport the contents of:"
349 eerror 398 eerror
350 eerror " ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}" 399 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
351 echo 400 echo
352 die "Failed Patch: ${x##*/}!" 401 die "Failed Patch: ${patchname}!"
353 fi 402 fi
354 403
355 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 404 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
356 405
357 eend 0 406 eend 0
358 fi 407 fi
359 done 408 done
360 if [ "${SINGLE_PATCH}" = "no" ] 409 if [ "${SINGLE_PATCH}" = "no" ]
864# name: the name that will show up in the menu 913# name: the name that will show up in the menu
865# icon: give your little like a pretty little icon ... 914# icon: give your little like a pretty little icon ...
866# this can be relative (to /usr/share/pixmaps) or 915# this can be relative (to /usr/share/pixmaps) or
867# a full path to an icon 916# a full path to an icon
868# type: what kind of application is this ? for categories: 917# type: what kind of application is this ? for categories:
869# http://www.freedesktop.org/standards/menu-spec/ 918# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
870# path: if your app needs to startup in a specific dir 919# path: if your app needs to startup in a specific dir
871make_desktop_entry() { 920make_desktop_entry() {
872 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 921 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
873 922
874 local exec="${1}" 923 local exec=${1}
875 local name="${2:-${PN}}" 924 local name=${2:-${PN}}
876 local icon="${3:-${PN}.png}" 925 local icon=${3:-${PN}.png}
877 local type="${4}" 926 local type=${4}
878 local subdir="${6}" 927 local path=${5}
879 local path="${5:-${GAMES_BINDIR}}" 928
880 if [ -z "${type}" ] 929 if [[ -z ${type} ]] ; then
881 then 930 local catmaj=${CATEGORY%%-*}
882 case ${CATEGORY} in 931 local catmin=${CATEGORY##*-}
883 "app-emulation") 932 case ${catmaj} in
884 type=Emulator 933 app)
885 subdir="Emulation" 934 case ${catmin} in
935 admin) type=System;;
936 cdr) type=DiscBurning;;
937 dicts) type=Dictionary;;
938 editors) type=TextEditor;;
939 emacs) type=TextEditor;;
940 emulation) type=Emulator;;
941 laptop) type=HardwareSettings;;
942 office) type=Office;;
943 vim) type=TextEditor;;
944 xemacs) type=TextEditor;;
945 *) type=;;
946 esac
886 ;; 947 ;;
887 "games-"*) 948
888 type=Game 949 dev)
889 subdir="Games" 950 type="Development"
890 ;; 951 ;;
891 "net-"*) 952
892 type=Network 953 games)
893 subdir="${type}" 954 [[ -z ${path} ]] && path=${GAMES_BINDIR}
955
956 case ${catmin} in
957 action) type=ActionGame;;
958 arcade) type=ArcadeGame;;
959 board) type=BoardGame;;
960 kid) type=KidsGame;;
961 emulation) type=Emulator;;
962 puzzle) type=LogicGame;;
963 rpg) type=RolePlaying;;
964 roguelike) type=RolePlaying;;
965 simulation) type=Simulation;;
966 sports) type=SportsGame;;
967 strategy) type=StrategyGame;;
968 *) type=;;
969 esac
970 type="Game;${type}"
894 ;; 971 ;;
972
973 mail)
974 type="Network;Email"
975 ;;
976
977 media)
978 case ${catmin} in
979 gfx) type=Graphics;;
980 radio) type=Tuner;;
981 sound) type=Audio;;
982 tv) type=TV;;
983 video) type=Video;;
984 *) type=;;
985 esac
986 type="AudioVideo;${type}"
987 ;;
988
989 net)
990 case ${catmin} in
991 dialup) type=Dialup;;
992 ftp) type=FileTransfer;;
993 im) type=InstantMessaging;;
994 irc) type=IRCClient;;
995 mail) type=Email;;
996 news) type=News;;
997 nntp) type=News;;
998 p2p) type=FileTransfer;;
999 *) type=;;
1000 esac
1001 type="Network;${type}"
1002 ;;
1003
1004 sci)
1005 case ${catmin} in
1006 astro*) type=Astronomoy;;
1007 bio*) type=Biology;;
1008 calc*) type=Calculator;;
1009 chem*) type=Chemistry;;
1010 geo*) type=Geology;;
1011 math*) type=Math;;
1012 *) type=;;
1013 esac
1014 type="Science;${type}"
1015 ;;
1016
1017 www)
1018 case ${catmin} in
1019 client) type=WebBrowser;;
1020 *) type=;;
1021 esac
1022 type="Network"
1023 ;;
1024
895 *) 1025 *)
896 type= 1026 type=
897 subdir=
898 ;; 1027 ;;
899 esac 1028 esac
900 fi 1029 fi
1030
901 local desktop="${T}/${exec}.desktop" 1031 local desktop=${T}/${exec%% *}-${P}.desktop
902 1032
903echo "[Desktop Entry] 1033echo "[Desktop Entry]
904Encoding=UTF-8 1034Encoding=UTF-8
905Version=0.9.2 1035Version=0.9.2
906Name=${name} 1036Name=${name}
1434# directories and uses the intersection of the lists. 1564# directories and uses the intersection of the lists.
1435# The -u builds a list of po files found in all the 1565# The -u builds a list of po files found in all the
1436# directories and uses the union of the lists. 1566# directories and uses the union of the lists.
1437strip-linguas() { 1567strip-linguas() {
1438 local ls newls 1568 local ls newls
1439 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1569 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1440 local op="$1"; shift 1570 local op=$1; shift
1441 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1571 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1442 local d f 1572 local d f
1443 for d in "$@" ; do 1573 for d in "$@" ; do
1444 if [ "${op}" == "-u" ] ; then 1574 if [[ ${op} == "-u" ]] ; then
1445 newls="${ls}" 1575 newls=${ls}
1446 else 1576 else
1447 newls="" 1577 newls=""
1448 fi 1578 fi
1449 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1579 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1450 if [ "${op}" == "-i" ] ; then 1580 if [[ ${op} == "-i" ]] ; then
1451 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1581 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1452 else 1582 else
1453 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1583 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1454 fi 1584 fi
1455 done 1585 done
1456 ls="${newls}" 1586 ls=${newls}
1457 done 1587 done
1458 ls="${ls//.po}" 1588 ls=${ls//.po}
1459 else 1589 else
1460 ls="$@" 1590 ls=$@
1461 fi 1591 fi
1462 1592
1463 ls=" ${ls} " 1593 ls=" ${ls} "
1464 newls="" 1594 newls=""
1465 for f in ${LINGUAS} ; do 1595 for f in ${LINGUAS} ; do
1466 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1596 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1467 newls="${newls} ${f}" 1597 newls="${newls} ${f}"
1468 else 1598 else
1469 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1599 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1470 fi 1600 fi
1471 done 1601 done
1472 if [ -z "${newls}" ] ; then 1602 if [[ -z ${newls} ]] ; then
1473 unset LINGUAS 1603 unset LINGUAS
1474 else 1604 else
1475 export LINGUAS="${newls}" 1605 export LINGUAS=${newls:1}
1476 fi 1606 fi
1477} 1607}
1478 1608
1479# moved from kernel.eclass since they are generally useful outside of 1609# moved from kernel.eclass since they are generally useful outside of
1480# kernel.eclass -iggy (20041002) 1610# kernel.eclass -iggy (20041002)
1602 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null 1732 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null
1603 done 1733 done
1604 eend 0 1734 eend 0
1605} 1735}
1606 1736
1607# dopamd [ file ] [ new file ] 1737# dopamd <file> [more files]
1608# 1738#
1609# Install pam auth config file in /etc/pam.d 1739# Install pam auth config file in /etc/pam.d
1610#
1611# The first argument, 'file' is required. Install as 'new file', if
1612# specified.
1613
1614dopamd() { 1740dopamd() {
1615 local pamd="$1" newpamd="${2:-$1}"
1616 [[ -z "$1" ]] && die "dopamd requires at least one argument." 1741 [[ -z $1 ]] && die "dopamd requires at least one argument"
1617 1742
1618 use pam || return 0 1743 use pam || return 0
1619 1744
1620 insinto /etc/pam.d 1745 insinto /etc/pam.d
1621 # these are the default doins options, but be explicit just in case 1746 doins "$@" || die "failed to install $@"
1622 insopts -m 0644 -o root -g root
1623 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}"
1624} 1747}
1748# newpamd <old name> <new name>
1749#
1750# Install pam file <old name> as <new name> in /etc/pam.d
1751newpamd() {
1752 [[ $# -ne 2 ]] && die "newpamd requires two arguements"
1753
1754 use pam || return 0
1755
1756 insinto /etc/pam.d
1757 newins "$1" "$2" || die "failed to install $1 as $2"
1758}
1759
1760# make a wrapper script ...
1761# NOTE: this was originally games_make_wrapper, but I noticed other places where
1762# this could be used, so I have moved it here and made it not games-specific
1763# -- wolf31o2
1764# $1 == wrapper name
1765# $2 == binary to run
1766# $3 == directory to chdir before running binary
1767# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1768make_wrapper() {
1769 local wrapper=$1 bin=$2 chdir=$3 libdir=$4
1770 local tmpwrapper=$(emktemp)
1771 cat << EOF > "${tmpwrapper}"
1772#!/bin/sh
1773cd "${chdir}"
1774export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1775exec ${bin} "\$@"
1776EOF
1777 chmod go+rx "${tmpwrapper}"
1778 newbin "${tmpwrapper}" "${wrapper}"
1779}

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.163

  ViewVC Help
Powered by ViewVC 1.1.20