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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Wed Jul 30 20:00:19 2014 UTC (7 weeks ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +3 -3 lines
better wording to eerror

1 ssuominen 1.13 # Copyright 1999-2014 Gentoo Foundation
2 ssuominen 1.1 # Distributed under the terms of the GNU General Public License v2
3 ssuominen 1.14 # $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.13 2014/07/30 19:49:46 ssuominen Exp $
4 ssuominen 1.1
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 ssuominen 1.12 # # Example of the eclass usage:
17     # RDEPEND="virtual/udev"
18 ssuominen 1.1 # DEPEND="${RDEPEND}"
19     #
20     # src_configure() {
21 ssuominen 1.9 # econf --with-rulesdir="$(get_udevdir)"/rules.d
22 ssuominen 1.5 # }
23     #
24     # src_install() {
25 ssuominen 1.9 # default
26 ssuominen 1.6 # # udev_dorules contrib/99-foomatic
27 ssuominen 1.9 # # udev_newrules contrib/98-foomatic 99-foomatic
28 ssuominen 1.1 # }
29     # @CODE
30    
31     inherit toolchain-funcs
32    
33     case ${EAPI:-0} in
34 ssuominen 1.2 0|1|2|3|4|5) ;;
35 ssuominen 1.1 *) 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 ssuominen 1.3 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
48 ssuominen 1.1 else
49 ssuominen 1.3 echo /lib/udev
50 ssuominen 1.1 fi
51     }
52    
53     # @FUNCTION: udev_get_udevdir
54     # @DESCRIPTION:
55 ssuominen 1.9 # Use the short version $(get_udevdir) instead!
56     udev_get_udevdir() {
57     debug-print-function ${FUNCNAME} "${@}"
58    
59 ssuominen 1.14 eerror "This ebuild should be using the get_udevdir() function instead of the deprecated udev_get_udevdir()"
60     die "Deprecated function call: udev_get_udevdir(), please report to (overlay) maintainers."
61 ssuominen 1.9 }
62    
63     # @FUNCTION: get_udevdir
64     # @DESCRIPTION:
65 ssuominen 1.1 # Output the path for the udev directory (not including ${D}).
66     # This function always succeeds, even if udev is not installed.
67     # The fallback value is set to /lib/udev
68 ssuominen 1.9 get_udevdir() {
69 ssuominen 1.1 debug-print-function ${FUNCNAME} "${@}"
70    
71 ssuominen 1.4 echo "$(_udev_get_udevdir)"
72     }
73    
74     # @FUNCTION: udev_dorules
75     # @USAGE: rules [...]
76     # @DESCRIPTION:
77     # Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
78     # and non-fatal in earlier EAPIs.
79     udev_dorules() {
80     debug-print-function ${FUNCNAME} "${@}"
81    
82     (
83     insinto "$(_udev_get_udevdir)"/rules.d
84     doins "${@}"
85     )
86     }
87    
88     # @FUNCTION: udev_newrules
89     # @USAGE: oldname newname
90     # @DESCRIPTION:
91     # Install udev rule with a new name. Uses newins, thus it is fatal
92     # in EAPI 4 and non-fatal in earlier EAPIs.
93     udev_newrules() {
94     debug-print-function ${FUNCNAME} "${@}"
95    
96     (
97     insinto "$(_udev_get_udevdir)"/rules.d
98     newins "${@}"
99     )
100 ssuominen 1.1 }
101 ssuominen 1.10
102     # @FUNCTION: udev_reload
103     # @DESCRIPTION:
104 ssuominen 1.11 # Run udevadm control --reload to refresh rules and databases
105 ssuominen 1.10 udev_reload() {
106     if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
107     return 0
108     fi
109    
110     if [[ -d ${ROOT}/run/udev ]]; then
111     ebegin "Running udev control --reload for reloading rules and databases"
112     udevadm control --reload
113     eend $?
114     fi
115     }

  ViewVC Help
Powered by ViewVC 1.1.20