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

Diff of /eclass/eutils.eclass

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

Revision 1.144 Revision 1.165
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.144 2005/02/03 22:11:33 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.165 2005/04/12 01:01:23 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.
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 CPU_FLAGS=$1
38 USER_CPU=`grep "flags" /proc/cpuinfo`
39
40 for flags in `seq 1 ${#CPU_FLAGS[@]}`
41 do
42 if has ${CPU_FLAGS[$flags - 1]} $USER_CPU && ! has ${CPU_FLAGS[$flags - 1]} $USE
43 then
44 ewarn "Your system is ${CPU_FLAGS[$flags - 1]} capable but you don't have it enabled!"
45 ewarn "You might be cross compiling (in this case set CROSSCOMPILE to 1 to disable this warning."
46 fi
47
48 if ! has ${CPU_FLAGS[$flags - 1]} $USER_CPU && has ${CPU_FLAGS[$flags -1]} $USE
49 then
50 ewarn "You have ${CPU_FLAGS[$flags - 1]} support enabled but your processor doesn't"
51 ewarn "Seem to support it! You might be cross compiling or do not have /proc filesystem"
52 ewarn "enabled. If either is the case, set CROSSCOMPILE to 1 to disable this warning."
53 fi
54 done
55}
56 19
57# Wait for the supplied number of seconds. If no argument is supplied, defaults 20# Wait for the supplied number of seconds. If no argument is supplied, defaults
58# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not 21# to five seconds. If the EPAUSE_IGNORE env var is set, don't wait. If we're not
59# outputting to a terminal, don't wait. For compatability purposes, the argument 22# outputting to a terminal, don't wait. For compatability purposes, the argument
60# must be an integer greater than zero. 23# must be an integer greater than zero.
102gen_usr_ldscript() { 65gen_usr_ldscript() {
103 local libdir="$(get_libdir)" 66 local libdir="$(get_libdir)"
104 # Just make sure it exists 67 # Just make sure it exists
105 dodir /usr/${libdir} 68 dodir /usr/${libdir}
106 69
70 for lib in "${@}" ; do
107 cat > "${D}/usr/${libdir}/${1}" << END_LDSCRIPT 71 cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
108/* GNU ld script 72 /* GNU ld script
109 Because Gentoo have critical dynamic libraries 73 Since Gentoo has critical dynamic libraries
110 in /lib, and the static versions in /usr/lib, we 74 in /lib, and the static versions in /usr/lib,
111 need to have a "fake" dynamic lib in /usr/lib, 75 we need to have a "fake" dynamic lib in /usr/lib,
112 otherwise we run into linking problems. 76 otherwise we run into linking problems.
113 See bug #4411 on http://bugs.gentoo.org/ for 77
114 more info. */ 78 See bug http://bugs.gentoo.org/4411 for more info.
79 */
115GROUP ( /${libdir}/${1} ) 80 GROUP ( /${libdir}/${lib} )
116END_LDSCRIPT 81 END_LDSCRIPT
117 fperms a+x "/usr/${libdir}/${1}" 82 fperms a+x "/usr/${libdir}/${lib}"
83 done
118} 84}
119 85
120# Simple function to draw a line consisting of '=' the same length as $* 86# Simple function to draw a line consisting of '=' the same length as $*
121# 87#
122# <azarah@gentoo.org> (11 Nov 2002) 88# <azarah@gentoo.org> (11 Nov 2002)
285 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \ 251 ([ "${SINGLE_PATCH}" = "yes" -o "${x/_all_}" != "${x}" -o "`eval echo \$\{x/_${ARCH}_\}`" != "${x}" ] || \
286 [ "${EPATCH_FORCE}" = "yes" ]) 252 [ "${EPATCH_FORCE}" = "yes" ])
287 then 253 then
288 local count=0 254 local count=0
289 local popts="${EPATCH_OPTS}" 255 local popts="${EPATCH_OPTS}"
256 local patchname=${x##*/}
290 257
291 if [ -n "${EPATCH_EXCLUDE}" ] 258 if [ -n "${EPATCH_EXCLUDE}" ]
292 then 259 then
293 if [ "`eval echo \$\{EPATCH_EXCLUDE/${x##*/}\}`" != "${EPATCH_EXCLUDE}" ] 260 if [ "${EPATCH_EXCLUDE/${patchname}}" != "${EPATCH_EXCLUDE}" ]
294 then 261 then
295 continue 262 continue
296 fi 263 fi
297 fi 264 fi
298 265
300 then 267 then
301 if [ -n "${EPATCH_SINGLE_MSG}" ] 268 if [ -n "${EPATCH_SINGLE_MSG}" ]
302 then 269 then
303 einfo "${EPATCH_SINGLE_MSG}" 270 einfo "${EPATCH_SINGLE_MSG}"
304 else 271 else
305 einfo "Applying ${x##*/} ..." 272 einfo "Applying ${patchname} ..."
306 fi 273 fi
307 else 274 else
308 einfo " ${x##*/} ..." 275 einfo " ${patchname} ..."
309 fi 276 fi
310 277
311 echo "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 278 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
312 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 279 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
313 280
314 # Allow for prefix to differ ... im lazy, so shoot me :/ 281 # Allow for prefix to differ ... im lazy, so shoot me :/
315 while [ "${count}" -lt 5 ] 282 while [ "${count}" -lt 5 ]
316 do 283 do
317 # Generate some useful debug info ... 284 # Generate some useful debug info ...
318 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 285 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
319 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 286 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
320 287
321 if [ "${PATCH_SUFFIX}" != "patch" ] 288 if [ "${PATCH_SUFFIX}" != "patch" ]
322 then 289 then
323 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 290 echo -n "PIPE_COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
324 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 291 echo "${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
325 else 292 else
326 PATCH_TARGET="${x}" 293 PATCH_TARGET="${x}"
327 fi 294 fi
328 295
329 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 296 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
330 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 297 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
331 298
332 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 299 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
333 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 300 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
334 301
335 if [ "${PATCH_SUFFIX}" != "patch" ] 302 if [ "${PATCH_SUFFIX}" != "patch" ]
336 then 303 then
337 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 304 if ! (${PIPE_CMD} ${x} > ${PATCH_TARGET}) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
338 then 305 then
339 echo 306 echo
340 eerror "Could not extract patch!" 307 eerror "Could not extract patch!"
341 #die "Could not extract patch!" 308 #die "Could not extract patch!"
342 count=5 309 count=5
343 break 310 break
344 fi 311 fi
345 fi 312 fi
346 313
347 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 314 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 2>&1
348 then 315 then
349 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 316 draw_line "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
350 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 317 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
351 echo "ACTUALLY APPLYING ${x##*/} ..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 318 echo "ACTUALLY APPLYING ${patchname} ..." >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
352 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 319 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
353 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 320 draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
354 321
355 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1 322 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real 2>&1
356 323
357 if [ "$?" -ne 0 ] 324 if [ "$?" -ne 0 ]
358 then 325 then
359 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 326 cat ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
360 echo 327 echo
361 eerror "A dry-run of patch command succeeded, but actually" 328 eerror "A dry-run of patch command succeeded, but actually"
362 eerror "applying the patch failed!" 329 eerror "applying the patch failed!"
363 #die "Real world sux compared to the dreamworld!" 330 #die "Real world sux compared to the dreamworld!"
364 count=5 331 count=5
365 fi 332 fi
366 333
367 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 334 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}.real
368 335
369 break 336 break
370 fi 337 fi
371 338
372 count=$((count + 1)) 339 count=$((count + 1))
378 fi 345 fi
379 346
380 if [ "${count}" -eq 5 ] 347 if [ "${count}" -eq 5 ]
381 then 348 then
382 echo 349 echo
383 eerror "Failed Patch: ${x##*/}!" 350 eerror "Failed Patch: ${patchname} !"
351 eerror " ( ${PATCH_TARGET} )"
384 eerror 352 eerror
385 eerror "Include in your bugreport the contents of:" 353 eerror "Include in your bugreport the contents of:"
386 eerror 354 eerror
387 eerror " ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}" 355 eerror " ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}"
388 echo 356 echo
389 die "Failed Patch: ${x##*/}!" 357 die "Failed Patch: ${patchname}!"
390 fi 358 fi
391 359
392 rm -f ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 360 rm -f ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
393 361
394 eend 0 362 eend 0
395 fi 363 fi
396 done 364 done
397 if [ "${SINGLE_PATCH}" = "no" ] 365 if [ "${SINGLE_PATCH}" = "no" ]
901# name: the name that will show up in the menu 869# name: the name that will show up in the menu
902# icon: give your little like a pretty little icon ... 870# icon: give your little like a pretty little icon ...
903# this can be relative (to /usr/share/pixmaps) or 871# this can be relative (to /usr/share/pixmaps) or
904# a full path to an icon 872# a full path to an icon
905# type: what kind of application is this ? for categories: 873# type: what kind of application is this ? for categories:
906# http://www.freedesktop.org/standards/menu-spec/ 874# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
907# path: if your app needs to startup in a specific dir 875# path: if your app needs to startup in a specific dir
908make_desktop_entry() { 876make_desktop_entry() {
909 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 877 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1
910 878
911 local exec="${1}" 879 local exec=${1}
912 local name="${2:-${PN}}" 880 local name=${2:-${PN}}
913 local icon="${3:-${PN}.png}" 881 local icon=${3:-${PN}.png}
914 local type="${4}" 882 local type=${4}
915 local subdir="${6}" 883 local path=${5}
916 local path="${5:-${GAMES_BINDIR}}" 884
917 if [ -z "${type}" ] 885 if [[ -z ${type} ]] ; then
918 then 886 local catmaj=${CATEGORY%%-*}
919 case ${CATEGORY} in 887 local catmin=${CATEGORY##*-}
920 "app-emulation") 888 case ${catmaj} in
921 type=Emulator 889 app)
922 subdir="Emulation" 890 case ${catmin} in
891 admin) type=System;;
892 cdr) type=DiscBurning;;
893 dicts) type=Dictionary;;
894 editors) type=TextEditor;;
895 emacs) type=TextEditor;;
896 emulation) type=Emulator;;
897 laptop) type=HardwareSettings;;
898 office) type=Office;;
899 vim) type=TextEditor;;
900 xemacs) type=TextEditor;;
901 *) type=;;
902 esac
923 ;; 903 ;;
924 "games-"*) 904
925 type=Game 905 dev)
926 subdir="Games" 906 type="Development"
927 ;; 907 ;;
928 "net-"*) 908
929 type=Network 909 games)
930 subdir="${type}" 910 [[ -z ${path} ]] && path=${GAMES_BINDIR}
911
912 case ${catmin} in
913 action) type=ActionGame;;
914 arcade) type=ArcadeGame;;
915 board) type=BoardGame;;
916 kid) type=KidsGame;;
917 emulation) type=Emulator;;
918 puzzle) type=LogicGame;;
919 rpg) type=RolePlaying;;
920 roguelike) type=RolePlaying;;
921 simulation) type=Simulation;;
922 sports) type=SportsGame;;
923 strategy) type=StrategyGame;;
924 *) type=;;
925 esac
926 type="Game;${type}"
931 ;; 927 ;;
928
929 mail)
930 type="Network;Email"
931 ;;
932
933 media)
934 case ${catmin} in
935 gfx) type=Graphics;;
936 radio) type=Tuner;;
937 sound) type=Audio;;
938 tv) type=TV;;
939 video) type=Video;;
940 *) type=;;
941 esac
942 type="AudioVideo;${type}"
943 ;;
944
945 net)
946 case ${catmin} in
947 dialup) type=Dialup;;
948 ftp) type=FileTransfer;;
949 im) type=InstantMessaging;;
950 irc) type=IRCClient;;
951 mail) type=Email;;
952 news) type=News;;
953 nntp) type=News;;
954 p2p) type=FileTransfer;;
955 *) type=;;
956 esac
957 type="Network;${type}"
958 ;;
959
960 sci)
961 case ${catmin} in
962 astro*) type=Astronomoy;;
963 bio*) type=Biology;;
964 calc*) type=Calculator;;
965 chem*) type=Chemistry;;
966 geo*) type=Geology;;
967 math*) type=Math;;
968 *) type=;;
969 esac
970 type="Science;${type}"
971 ;;
972
973 www)
974 case ${catmin} in
975 client) type=WebBrowser;;
976 *) type=;;
977 esac
978 type="Network"
979 ;;
980
932 *) 981 *)
933 type= 982 type=
934 subdir=
935 ;; 983 ;;
936 esac 984 esac
937 fi 985 fi
986
938 local desktop="${T}/${exec}.desktop" 987 local desktop=${T}/${exec%% *}-${P}.desktop
939 988
940echo "[Desktop Entry] 989echo "[Desktop Entry]
941Encoding=UTF-8 990Encoding=UTF-8
942Version=0.9.2 991Version=0.9.2
943Name=${name} 992Name=${name}
1471# directories and uses the intersection of the lists. 1520# directories and uses the intersection of the lists.
1472# The -u builds a list of po files found in all the 1521# The -u builds a list of po files found in all the
1473# directories and uses the union of the lists. 1522# directories and uses the union of the lists.
1474strip-linguas() { 1523strip-linguas() {
1475 local ls newls 1524 local ls newls
1476 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1525 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1477 local op="$1"; shift 1526 local op=$1; shift
1478 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1527 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1479 local d f 1528 local d f
1480 for d in "$@" ; do 1529 for d in "$@" ; do
1481 if [ "${op}" == "-u" ] ; then 1530 if [[ ${op} == "-u" ]] ; then
1482 newls="${ls}" 1531 newls=${ls}
1483 else 1532 else
1484 newls="" 1533 newls=""
1485 fi 1534 fi
1486 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1535 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1487 if [ "${op}" == "-i" ] ; then 1536 if [[ ${op} == "-i" ]] ; then
1488 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1537 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1489 else 1538 else
1490 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1539 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1491 fi 1540 fi
1492 done 1541 done
1493 ls="${newls}" 1542 ls=${newls}
1494 done 1543 done
1495 ls="${ls//.po}" 1544 ls=${ls//.po}
1496 else 1545 else
1497 ls="$@" 1546 ls=$@
1498 fi 1547 fi
1499 1548
1500 ls=" ${ls} " 1549 ls=" ${ls} "
1501 newls="" 1550 newls=""
1502 for f in ${LINGUAS} ; do 1551 for f in ${LINGUAS} ; do
1503 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1552 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1504 newls="${newls} ${f}" 1553 newls="${newls} ${f}"
1505 else 1554 else
1506 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1555 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1507 fi 1556 fi
1508 done 1557 done
1509 if [ -z "${newls}" ] ; then 1558 if [[ -z ${newls} ]] ; then
1510 unset LINGUAS 1559 unset LINGUAS
1511 else 1560 else
1512 export LINGUAS="${newls}" 1561 export LINGUAS=${newls:1}
1513 fi 1562 fi
1514} 1563}
1515 1564
1516# moved from kernel.eclass since they are generally useful outside of 1565# moved from kernel.eclass since they are generally useful outside of
1517# kernel.eclass -iggy (20041002) 1566# kernel.eclass -iggy (20041002)
1639 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null 1688 patch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null
1640 done 1689 done
1641 eend 0 1690 eend 0
1642} 1691}
1643 1692
1644# dopamd [ file ] [ new file ] 1693# dopamd <file> [more files]
1645# 1694#
1646# Install pam auth config file in /etc/pam.d 1695# Install pam auth config file in /etc/pam.d
1647#
1648# The first argument, 'file' is required. Install as 'new file', if
1649# specified.
1650
1651dopamd() { 1696dopamd() {
1652 local pamd="$1" newpamd="${2:-$1}"
1653 [[ -z "$1" ]] && die "dopamd requires at least one argument." 1697 [[ -z $1 ]] && die "dopamd requires at least one argument"
1654 1698
1655 use pam || return 0 1699 use pam || return 0
1656 1700
1657 insinto /etc/pam.d 1701 insinto /etc/pam.d
1658 # these are the default doins options, but be explicit just in case 1702 doins "$@" || die "failed to install $@"
1659 insopts -m 0644 -o root -g root
1660 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}"
1661} 1703}
1704# newpamd <old name> <new name>
1705#
1706# Install pam file <old name> as <new name> in /etc/pam.d
1707newpamd() {
1708 [[ $# -ne 2 ]] && die "newpamd requires two arguements"
1709
1710 use pam || return 0
1711
1712 insinto /etc/pam.d
1713 newins "$1" "$2" || die "failed to install $1 as $2"
1714}
1715
1716# make a wrapper script ...
1717# NOTE: this was originally games_make_wrapper, but I noticed other places where
1718# this could be used, so I have moved it here and made it not games-specific
1719# -- wolf31o2
1720# $1 == wrapper name
1721# $2 == binary to run
1722# $3 == directory to chdir before running binary
1723# $4 == extra LD_LIBRARY_PATH's (make it : delimited)
1724# $5 == path for wrapper
1725make_wrapper() {
1726 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
1727 local tmpwrapper=$(emktemp)
1728 cat << EOF > "${tmpwrapper}"
1729#!/bin/sh
1730cd "${chdir}"
1731export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1732exec ${bin} "\$@"
1733EOF
1734 chmod go+rx "${tmpwrapper}"
1735 if [ -n "${5}" ]
1736 then
1737 exeinto ${5}
1738 newexe "${tmpwrapper}" "${wrapper}"
1739 else
1740 newbin "${tmpwrapper}" "${wrapper}"
1741 fi
1742}

Legend:
Removed from v.1.144  
changed lines
  Added in v.1.165

  ViewVC Help
Powered by ViewVC 1.1.20