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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Wed Jul 30 19:49:46 2014 UTC (7 weeks, 3 days ago) by ssuominen
Branch: MAIN
Changes since 1.12: +4 -3 lines
Deprecate the longer udev_get_udevdir() function in favour of the shorter get_udevdir(), notably gentoo-x86 has been fully converted

1 # Copyright 1999-2014 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.12 2014/07/13 19:33:09 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 eerror "Use the shorter get_udevdir() instead of longer udev_get_udevdir()"
60 die "Deprecated function call: udev_get_udevdir()"
61 }
62
63 # @FUNCTION: get_udevdir
64 # @DESCRIPTION:
65 # 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 get_udevdir() {
69 debug-print-function ${FUNCNAME} "${@}"
70
71 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 }
101
102 # @FUNCTION: udev_reload
103 # @DESCRIPTION:
104 # Run udevadm control --reload to refresh rules and databases
105 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