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

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

  ViewVC Help
Powered by ViewVC 1.1.20