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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Sun Jul 13 19:33:09 2014 UTC (4 months, 2 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.11: +3 -4 lines
Prune outdated stuff from comments

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.11 2013/03/24 15:52:01 ssuominen Exp $
4
5 # @ECLASS: udev.eclass
6 # @MAINTAINER:
7 # udev-bugs@gentoo.org
8 # @BLURB: Default eclass for determining udev directories.
9 # @DESCRIPTION:
10 # Default eclass for determining udev directories.
11 # @EXAMPLE:
12 #
13 # @CODE
14 # inherit udev
15 #
16 # # Example of the eclass usage:
17 # RDEPEND="virtual/udev"
18 # DEPEND="${RDEPEND}"
19 #
20 # src_configure() {
21 # econf --with-rulesdir="$(get_udevdir)"/rules.d
22 # }
23 #
24 # src_install() {
25 # default
26 # # udev_dorules contrib/99-foomatic
27 # # udev_newrules contrib/98-foomatic 99-foomatic
28 # }
29 # @CODE
30
31 inherit toolchain-funcs
32
33 case ${EAPI:-0} in
34 0|1|2|3|4|5) ;;
35 *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
36 esac
37
38 RDEPEND=""
39 DEPEND="virtual/pkgconfig"
40
41 # @FUNCTION: _udev_get_udevdir
42 # @INTERNAL
43 # @DESCRIPTION:
44 # Get unprefixed udevdir.
45 _udev_get_udevdir() {
46 if $($(tc-getPKG_CONFIG) --exists udev); then
47 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
48 else
49 echo /lib/udev
50 fi
51 }
52
53 # @FUNCTION: udev_get_udevdir
54 # @DESCRIPTION:
55 # Use the short version $(get_udevdir) instead!
56 udev_get_udevdir() {
57 debug-print-function ${FUNCNAME} "${@}"
58
59 echo "$(_udev_get_udevdir)"
60 }
61
62 # @FUNCTION: get_udevdir
63 # @DESCRIPTION:
64 # Output the path for the udev directory (not including ${D}).
65 # This function always succeeds, even if udev is not installed.
66 # The fallback value is set to /lib/udev
67 get_udevdir() {
68 debug-print-function ${FUNCNAME} "${@}"
69
70 echo "$(_udev_get_udevdir)"
71 }
72
73 # @FUNCTION: udev_dorules
74 # @USAGE: rules [...]
75 # @DESCRIPTION:
76 # Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
77 # and non-fatal in earlier EAPIs.
78 udev_dorules() {
79 debug-print-function ${FUNCNAME} "${@}"
80
81 (
82 insinto "$(_udev_get_udevdir)"/rules.d
83 doins "${@}"
84 )
85 }
86
87 # @FUNCTION: udev_newrules
88 # @USAGE: oldname newname
89 # @DESCRIPTION:
90 # Install udev rule with a new name. Uses newins, thus it is fatal
91 # in EAPI 4 and non-fatal in earlier EAPIs.
92 udev_newrules() {
93 debug-print-function ${FUNCNAME} "${@}"
94
95 (
96 insinto "$(_udev_get_udevdir)"/rules.d
97 newins "${@}"
98 )
99 }
100
101 # @FUNCTION: udev_reload
102 # @DESCRIPTION:
103 # Run udevadm control --reload to refresh rules and databases
104 udev_reload() {
105 if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
106 return 0
107 fi
108
109 if [[ -d ${ROOT}/run/udev ]]; then
110 ebegin "Running udev control --reload for reloading rules and databases"
111 udevadm control --reload
112 eend $?
113 fi
114 }

  ViewVC Help
Powered by ViewVC 1.1.20