/[gentoo-x86]/sys-fs/udev/udev-115-r2.ebuild
Gentoo

Contents of /sys-fs/udev/udev-115-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Fri Sep 7 06:32:36 2007 UTC (7 years, 2 months ago) by zzam
Branch: MAIN
Changes since 1.2: +2 -2 lines
Fixed md5sum of rules-file.
(Portage version: 2.1.3.7)

1 zzam 1.1 # Copyright 1999-2007 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 zzam 1.3 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-115-r2.ebuild,v 1.2 2007/09/07 06:30:21 zzam Exp $
4 zzam 1.1
5     inherit eutils flag-o-matic multilib toolchain-funcs versionator
6    
7 zzam 1.2 PATCH="${P}-update-20070907.diff"
8 zzam 1.1 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
9     HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
10     SRC_URI="mirror://kernel/linux/utils/kernel/hotplug/${P}.tar.bz2
11     mirror://gentoo/${PATCH}.bz2
12     http://dev.gentoo.org/~zzam/distfiles/${PATCH}.bz2"
13    
14     LICENSE="GPL-2"
15     SLOT="0"
16     KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
17     IUSE="selinux"
18    
19     DEPEND="selinux? ( sys-libs/libselinux )"
20     RDEPEND="!sys-apps/coldplug
21     !<sys-fs/device-mapper-1.02.19-r1"
22     RDEPEND="${DEPEND} ${RDEPEND}
23     >=sys-apps/baselayout-1.12.5"
24     # We need the lib/rcscripts/addon support
25     PROVIDE="virtual/dev-manager"
26    
27     pkg_setup() {
28     udev_helper_dir="/$(get_libdir)/udev"
29    
30     myconf=
31     extras="extras/ata_id \
32     extras/cdrom_id \
33     extras/edd_id \
34     extras/firmware \
35     extras/floppy \
36     extras/path_id \
37     extras/scsi_id \
38     extras/usb_id \
39     extras/volume_id \
40     extras/collect \
41     extras/rule_generator \
42     extras/root_link"
43    
44     use selinux && myconf="${myconf} USE_SELINUX=true"
45    
46     # comparing kernel version without linux-info.eclass to not pull
47     # virtual/linux-sources
48    
49     local KV=$(uname -r)
50     local KV_MAJOR=$(get_major_version ${KV})
51     local KV_MINOR=$(get_version_component_range 2 ${KV})
52     local KV_MICRO=$(get_version_component_range 3 ${KV})
53    
54     local ok=0
55     if [[ "${KV_MAJOR}" == 2 ]] && [[ "${KV_MINOR}" == 6 ]] && [[ "${KV_MICRO}" -ge 15 ]]; then
56     ok=1
57     fi
58    
59     if [[ "$ok" = "0" ]]; then
60     ewarn
61     ewarn "${P} does not support Linux kernel before version 2.6.15!"
62     ewarn "If you want to use udev you need to update"
63     ewarn "to kernel >=2.6.15!"
64     ewarn
65     ebeep
66     fi
67     }
68    
69     sed_helper_dir() {
70     sed -e "s#/lib/udev#${udev_helper_dir}#" -i "$@"
71     }
72    
73     src_unpack() {
74     unpack ${A}
75    
76     cd "${S}"
77    
78     # patches go here...
79     epatch "${WORKDIR}/${PATCH}"
80     EPATCH_OPTS="-p1" epatch "${FILESDIR}/udev-115-add-special-rule-files.diff"
81     EPATCH_OPTS="-p1" epatch "${FILESDIR}/${PN}-114-root-link-2.diff"
82    
83     # no longer needed
84     rm etc/udev/gentoo/50-udev.rules
85    
86     # No need to clutter the logs ...
87     sed -ie '/^DEBUG/ c\DEBUG = false' Makefile
88     # Do not use optimization flags from the package
89     sed -ie 's|$(OPTIMIZATION)||g' Makefile
90     # Do not require xmlto to refresh manpages
91     sed -ie 's|$(MAN_PAGES)||g' Makefile
92    
93     # Make sure there is no sudden changes to upstream rules file
94     # (more for my own needs than anything else ...)
95     MD5=`md5sum < "${S}/etc/udev/rules.d/50-udev-default.rules"`
96     MD5=${MD5/ -/}
97 zzam 1.3 if [ "${MD5}" != "644e3c77eb866dee4ff8dda2e95cd187" ]
98 zzam 1.1 then
99     echo
100     eerror "50-udev-default.rules has been updated, please validate!"
101     die "50-udev-default.rules has been updated, please validate!"
102     fi
103    
104     sed_helper_dir \
105     etc/udev/rules.d/50-udev-default.rules \
106     extras/rule_generator/write_*_rules \
107     udev_rules_parse.c \
108     udev_rules.c
109    
110     # Use correct multilib dir
111     sed -i extras/volume_id/lib/Makefile \
112     -e "/ =/s-/lib-/$(get_libdir)-"
113     }
114    
115     src_compile() {
116     filter-flags -fprefetch-loop-arrays
117    
118     # Not everyone has full $CHOST-{ld,ar,etc...} yet
119     local mycross=""
120     type -p ${CHOST}-ar && mycross=${CHOST}-
121    
122     emake \
123     EXTRAS="${extras}" \
124     libudevdir=${udev_helper_dir} \
125     CROSS_COMPILE=${mycross} \
126     OPTFLAGS="" \
127     ${myconf} || die
128     }
129    
130     src_install() {
131     into /
132     emake \
133     DESTDIR="${D}" \
134     libudevdir=${udev_helper_dir} \
135     EXTRAS="${extras}" \
136     ${myconf} \
137     install || die
138    
139     # make install does not install this
140     dosbin udevstart || die "Required binary not installed properly"
141     doman udevstart.8
142    
143     exeinto "${udev_helper_dir}"
144     newexe "${FILESDIR}"/net-104-r10.sh net.sh || die "Required binary not installed properly"
145     newexe "${FILESDIR}"/modprobe-115.sh modprobe.sh || die "Required binary not installed properly"
146     newexe "${FILESDIR}"/move_tmp_persistent_rules-112-r1.sh move_tmp_persistent_rules.sh \
147     || die "Required binary not installed properly"
148    
149     keepdir "${udev_helper_dir}"/state
150     keepdir "${udev_helper_dir}"/devices
151    
152     # create symlinks for these utilities to /sbin
153     # where multipath-tools expect them to be (Bug #168588)
154     dosym "..${udev_helper_dir}/vol_id" /sbin/vol_id
155     dosym "..${udev_helper_dir}/scsi_id" /sbin/scsi_id
156    
157     # vol_id library (needed by mount and HAL)
158     into /
159     rm "${D}/$(get_libdir)"/libvolume_id.so* 2>/dev/null
160     dolib extras/volume_id/lib/*.so* || die "Failed installing libvolume_id.so"
161     into /usr
162     dolib extras/volume_id/lib/*.a || die "Failed installing libvolume_id.a"
163    
164     # handle static linking bug #4411
165     rm -f "${D}/usr/$(get_libdir)/libvolume_id.so"
166     gen_usr_ldscript libvolume_id.so
167    
168     # Add gentoo stuff to udev.conf
169     cat "${FILESDIR}"/udev.conf.post_114 >> "${D}"/etc/udev/udev.conf
170    
171     # Now installing rules
172     cd etc/udev
173     insinto /etc/udev/rules.d/
174    
175     # Our rules files
176     doins gentoo/??-*.rules
177    
178     # Adding arch specific rules
179     if [[ -f "packages/40-${ARCH}.rules" ]]; then
180     doins "packages/40-${ARCH}.rules"
181     fi
182     cd "${S}"
183    
184     # our udev hooks into the rc system
185     insinto /$(get_libdir)/rcscripts/addons
186     newins "${FILESDIR}"/udev-start-114-r1.sh udev-start.sh
187     newins "${FILESDIR}"/udev-stop-111-r2.sh udev-stop.sh
188    
189     # The udev-post init-script
190     newinitd "${FILESDIR}"/udev-postmount-initd-111-r2 udev-postmount
191    
192     insinto /etc/modprobe.d
193     newins ${FILESDIR}/blacklist-110 blacklist
194     doins ${FILESDIR}/pnp-aliases
195    
196     # use our modprobe-wrapper
197     sed -e '/while read id/s#/sbin/modprobe#/lib/udev/modprobe.sh#' \
198     -e 's#/sbin/modprobe#modprobe.sh#' \
199     -i "${D}"/etc/udev/rules.d/80-drivers.rules
200    
201     # convert /lib/udev to real used dir
202     sed_helper_dir \
203     "${D}/$(get_libdir)"/rcscripts/addons/*.sh \
204     "${D}"/etc/init.d/udev* \
205     "${D}"/etc/modprobe.d/*
206    
207     # documentation
208     dodoc ChangeLog FAQ README TODO RELEASE-NOTES
209     dodoc docs/{overview,udev_vs_devfs}
210     dodoc docs/writing_udev_rules/*
211    
212     newdoc extras/volume_id/README README_volume_id
213    
214     echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > 20udev
215     doenvd 20udev
216     }
217    
218     pkg_preinst() {
219     if [[ -d "${ROOT}"/lib/udev-state ]] ; then
220     mv -f "${ROOT}"/lib/udev-state/* "${D}"/lib/udev/state/
221     rm -r "${ROOT}"/lib/udev-state
222     fi
223    
224     if [ -f "${ROOT}/etc/udev/udev.config" -a \
225     ! -f "${ROOT}/etc/udev/udev.rules" ]
226     then
227     mv -f "${ROOT}"/etc/udev/udev.config "${ROOT}"/etc/udev/udev.rules
228     fi
229    
230     # delete the old udev.hotplug symlink if it is present
231     if [ -h "${ROOT}/etc/hotplug.d/default/udev.hotplug" ]
232     then
233     rm -f "${ROOT}"/etc/hotplug.d/default/udev.hotplug
234     fi
235    
236     # delete the old wait_for_sysfs.hotplug symlink if it is present
237     if [ -h "${ROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug" ]
238     then
239     rm -f "${ROOT}"/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
240     fi
241    
242     # delete the old wait_for_sysfs.hotplug symlink if it is present
243     if [ -h "${ROOT}/etc/hotplug.d/default/10-udev.hotplug" ]
244     then
245     rm -f "${ROOT}"/etc/hotplug.d/default/10-udev.hotplug
246     fi
247    
248     # is there a stale coldplug initscript? (CONFIG_PROTECT leaves it behind)
249     coldplug_stale=""
250     if [ -f "${ROOT}/etc/init.d/coldplug" ]
251     then
252     coldplug_stale="1"
253     fi
254     }
255    
256     pkg_postinst() {
257     # people want reminders, I'll give them reminders. Odds are they will
258     # just ignore them anyway...
259    
260     if [[ ${coldplug_stale} == "1" ]] ; then
261     ewarn "A stale coldplug init script found. You should run:"
262     ewarn
263     ewarn " rc-update del coldplug"
264     ewarn " rm -f /etc/init.d/coldplug"
265     ewarn
266     ewarn "udev now provides its own coldplug functionality."
267     fi
268    
269     # delete 40-scsi-hotplug.rules - all integrated in 50-udev.rules
270     if has_version "=sys-fs/udev-103-r3"; then
271     if [[ -e "${ROOT}/etc/udev/rules.d/40-scsi-hotplug.rules" ]]
272     then
273     ewarn "Deleting stray 40-scsi-hotplug.rules"
274     ewarn "installed by sys-fs/udev-103-r3"
275     rm -f "${ROOT}"/etc/udev/rules.d/40-scsi-hotplug.rules
276     fi
277     fi
278    
279     # Removing some device-nodes we thought we need some time ago
280     if [[ -d "${ROOT}"/lib/udev/devices ]]; then
281     rm -f "${ROOT}"/lib/udev/devices/{null,zero,console,urandom}
282     fi
283    
284     # Removing some old file
285     if has_version "<sys-fs/udev-104-r5"; then
286     rm -f "${ROOT}"/etc/dev.d/net/hotplug.dev
287     rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/net 2>/dev/null
288     fi
289    
290     if has_version "<sys-fs/udev-106-r5"; then
291     if [[ -e "${ROOT}"/etc/udev/rules.d/95-net.rules ]]; then
292     rm -f "${ROOT}"/etc/udev/rules.d/95-net.rules
293     fi
294     fi
295    
296     # Try to remove /etc/dev.d as that is obsolete
297     if [[ -d "${ROOT}"/etc/dev.d ]]; then
298     rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/default "${ROOT}"/etc/dev.d 2>/dev/null
299     if [[ -d "${ROOT}"/etc/dev.d ]]; then
300     ewarn "You still have the directory /etc/dev.d on your system."
301     ewarn "This is no longer used by udev and can be removed."
302     fi
303     fi
304    
305     # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
306     # remove it if user don't has sys-fs/device-mapper installed
307     if has_version "<sys-fs/udev-113" &&
308     [[ -f "${ROOT}"/etc/udev/rules.d/64-device-mapper.rules ]] &&
309     ! has_version sys-fs/device-mapper
310     then
311     rm -f "${ROOT}"/etc/udev/rules.d/64-device-mapper.rules
312     einfo "Removed unneeded file 64-device-mapper.rules"
313     fi
314    
315     if [[ "${ROOT}" == "/" ]] ; then
316     # check if root of init-process is identical to ours
317     if [ -r /proc/1/root -a /proc/1/root/ -ef /proc/self/root/ ]; then
318     einfo "restarting udevd now."
319     if [[ -n $(pidof udevd) ]] ; then
320     killall -15 udevd &>/dev/null
321     sleep 1
322     killall -9 udevd &>/dev/null
323     fi
324     /sbin/udevd --daemon
325     fi
326     fi
327    
328     einfo
329     einfo "For more information on udev on Gentoo, writing udev rules, and"
330     einfo " fixing known issues visit:"
331     einfo " http://www.gentoo.org/doc/en/udev-guide.xml"
332     }

  ViewVC Help
Powered by ViewVC 1.1.20