Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-fs/udev: udev-135-r3.ebuild ChangeLog
Date: Sat, 27 Dec 2008 23:03:54
Message-Id: E1LGiCG-0003ml-8X@stork.gentoo.org
1 zzam 08/12/27 23:03:52
2
3 Modified: ChangeLog
4 Added: udev-135-r3.ebuild
5 Log:
6 Create /dev/.rcsysinit only for older baselayouts. Add some comments about rc_oldplug to /etc/conf.d/udev, suggested by Polynomial-C <polynomial-c@×××.de>.
7 (Portage version: 2.1.6.2/cvs/Linux 2.6.27-gentoo-r1 i686)
8
9 Revision Changes Path
10 1.431 sys-fs/udev/ChangeLog
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/ChangeLog?rev=1.431&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/ChangeLog?rev=1.431&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/ChangeLog?r1=1.430&r2=1.431
15
16 Index: ChangeLog
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v
19 retrieving revision 1.430
20 retrieving revision 1.431
21 diff -u -r1.430 -r1.431
22 --- ChangeLog 19 Dec 2008 22:40:58 -0000 1.430
23 +++ ChangeLog 27 Dec 2008 23:03:52 -0000 1.431
24 @@ -1,6 +1,15 @@
25 # ChangeLog for sys-fs/udev
26 # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
27 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.430 2008/12/19 22:40:58 zzam Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.431 2008/12/27 23:03:52 zzam Exp $
29 +
30 +*udev-135-r3 (27 Dec 2008)
31 +
32 + 27 Dec 2008; Matthias Schwarzott <zzam@g.o>
33 + +files/udev-135-r3.confd, +files/udev-mount-135-r3.initd,
34 + +files/udev-start-135-r3.sh, +udev-135-r3.ebuild:
35 + Create /dev/.rcsysinit only for older baselayouts. Add some comments about
36 + rc_oldplug to /etc/conf.d/udev, suggested by Polynomial-C
37 + <polynomial-c@×××.de>.
38
39 19 Dec 2008; Matthias Schwarzott <zzam@g.o>
40 +files/udev-postmount-135-r2.initd, files/udev-start-135-r2.sh,
41
42
43
44 1.1 sys-fs/udev/udev-135-r3.ebuild
45
46 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/udev-135-r3.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/udev-135-r3.ebuild?rev=1.1&content-type=text/plain
48
49 Index: udev-135-r3.ebuild
50 ===================================================================
51 # Copyright 1999-2008 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-135-r3.ebuild,v 1.1 2008/12/27 23:03:52 zzam Exp $
54
55 inherit eutils flag-o-matic multilib toolchain-funcs versionator
56
57 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
58 HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
59 SRC_URI="mirror://kernel/linux/utils/kernel/hotplug/${P}.tar.bz2"
60
61 LICENSE="GPL-2"
62 SLOT="0"
63 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
64 IUSE="selinux"
65
66 DEPEND="selinux? ( sys-libs/libselinux )"
67 RDEPEND="!sys-apps/coldplug
68 !<sys-fs/device-mapper-1.02.19-r1"
69 RDEPEND="${DEPEND} ${RDEPEND}
70 >=sys-apps/baselayout-1.12.5"
71 # We need the lib/rcscripts/addon support
72 PROVIDE="virtual/dev-manager"
73
74 pkg_setup() {
75 udev_helper_dir="/$(get_libdir)/udev"
76
77 # comparing kernel version without linux-info.eclass to not pull
78 # virtual/linux-sources
79
80 local KV=$(uname -r)
81 local KV_MAJOR=$(get_major_version ${KV})
82 local KV_MINOR=$(get_version_component_range 2 ${KV})
83 local KV_MICRO=$(get_version_component_range 3 ${KV})
84
85 local min_micro=15 min_micro_reliable=19
86
87 local ok=0
88 if [[ ${KV_MAJOR} == 2 && ${KV_MINOR} == 6 ]]
89 then
90 if [[ ${KV_MICRO} -ge ${min_micro_reliable} ]]; then
91 ok=2
92 elif [[ ${KV_MICRO} -ge ${min_micro} ]]; then
93 ok=1
94 fi
95 fi
96
97 if [[ ${ok} -lt 1 ]]
98 then
99 ewarn
100 ewarn "${P} does not support Linux kernel before version 2.6.${min_micro}!"
101 fi
102 if [[ ${ok} -lt 2 ]]; then
103 ewarn "If you want to use udev reliable you should update"
104 ewarn "to at least kernel version 2.6.${min_micro_reliable}!"
105 ewarn
106 ebeep
107 fi
108 }
109
110 sed_helper_dir() {
111 sed -e "s#/lib/udev#${udev_helper_dir}#" -i "$@"
112 }
113
114 src_unpack() {
115 unpack ${A}
116
117 cd "${S}"
118
119 # patches go here...
120 epatch "${FILESDIR}/${P}-fix-capi.diff"
121 epatch "${FILESDIR}/${P}-rules-update.diff"
122
123 # Make sure there is no sudden changes to upstream rules file
124 # (more for my own needs than anything else ...)
125 MD5=$(md5sum < "${S}/rules/rules.d/50-udev-default.rules")
126 MD5=${MD5/ -/}
127 if [[ ${MD5} != 1425ecb365439f74b9aa2242f0503f1e ]]
128 then
129 echo
130 eerror "50-udev-default.rules has been updated, please validate!"
131 die "50-udev-default.rules has been updated, please validate!"
132 fi
133
134 sed_helper_dir \
135 rules/rules.d/50-udev-default.rules \
136 extras/rule_generator/write_*_rules \
137 udev/udev-util.c \
138 udev/udev-rules.c \
139 udev/udevd.c || die "sed failed"
140 }
141
142 src_compile() {
143 filter-flags -fprefetch-loop-arrays
144
145 econf \
146 --prefix=/usr \
147 --sysconfdir=/etc \
148 --exec-prefix= \
149 --with-libdir-name=$(get_libdir) \
150 --enable-logging \
151 $(use_with selinux)
152
153 emake || die "compiling udev failed"
154 }
155
156 src_install() {
157 into /
158 emake DESTDIR="${D}" install || die "make install failed"
159 if [[ "$(get_libdir)" != "lib" ]]; then
160 # we can not just rename /lib to /lib64, because
161 # make install creates /lib64 and /lib
162 mkdir -p "${D}/$(get_libdir)"
163 mv "${D}"/lib/* "${D}/$(get_libdir)/"
164 rmdir "${D}"/lib
165 fi
166
167 exeinto "${udev_helper_dir}"
168 newexe "${FILESDIR}"/net-130-r1.sh net.sh || die "net.sh not installed properly"
169 newexe "${FILESDIR}"/move_tmp_persistent_rules-112-r1.sh move_tmp_persistent_rules.sh \
170 || die "move_tmp_persistent_rules.sh not installed properly"
171 newexe "${FILESDIR}"/write_root_link_rule-125 write_root_link_rule \
172 || die "write_root_link_rule not installed properly"
173 newexe "${FILESDIR}"/shell-compat-118-r3.sh shell-compat.sh \
174 || die "shell-compat.sh not installed properly"
175
176 keepdir "${udev_helper_dir}"/state
177 keepdir "${udev_helper_dir}"/devices
178
179 # create symlinks for these utilities to /sbin
180 # where multipath-tools expect them to be (Bug #168588)
181 dosym "..${udev_helper_dir}/vol_id" /sbin/vol_id
182 dosym "..${udev_helper_dir}/scsi_id" /sbin/scsi_id
183
184 # Add gentoo stuff to udev.conf
185 echo "# If you need to change mount-options, do it in /etc/fstab" \
186 >> "${D}"/etc/udev/udev.conf
187
188 # let the dir exist at least
189 keepdir /etc/udev/rules.d
190
191 # Now installing rules
192 cd "${S}"/rules
193 insinto "${udev_helper_dir}"/rules.d/
194
195 # Our rules files
196 doins gentoo/??-*.rules
197 doins packages/40-alsa.rules
198 doins packages/40-isdn.rules
199
200 # Adding arch specific rules
201 if [[ -f packages/40-${ARCH}.rules ]]
202 then
203 doins "packages/40-${ARCH}.rules"
204 fi
205 cd "${S}"
206
207 # our udev hooks into the rc system
208 insinto /$(get_libdir)/rcscripts/addons
209 newins "${FILESDIR}"/udev-start-135-r3.sh udev-start.sh
210 newins "${FILESDIR}"/udev-stop-135-r2.sh udev-stop.sh
211
212 # The udev-post init-script
213 newinitd "${FILESDIR}"/udev-postmount-135-r2.initd udev-postmount
214
215 # init-scripts for >=openrc-0.3.1, Bug #240984
216 newinitd "${FILESDIR}/udev-135-r2.initd" udev
217 newinitd "${FILESDIR}/udev-mount-135-r3.initd" udev-mount
218 newinitd "${FILESDIR}/udev-dev-tarball-135-r2.initd" udev-dev-tarball
219
220 # config file for init-script and start-addon
221 newconfd "${FILESDIR}/udev-135-r3.confd" udev
222
223 insinto /etc/modprobe.d
224 newins "${FILESDIR}"/blacklist-110 blacklist
225 doins "${FILESDIR}"/pnp-aliases
226
227 # convert /lib/udev to real used dir
228 sed_helper_dir \
229 "${D}/$(get_libdir)"/rcscripts/addons/*.sh \
230 "${D}"/etc/init.d/udev* \
231 "${D}"/etc/modprobe.d/*
232
233 # documentation
234 dodoc ChangeLog README TODO || die "failed installing docs"
235
236 cd docs/writing_udev_rules
237 mv index.html writing_udev_rules.html
238 dohtml *.html
239
240 cd "${S}"
241
242 newdoc extras/volume_id/README README_volume_id
243
244 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > 20udev
245 doenvd 20udev
246 }
247
248 pkg_preinst() {
249 if [[ -d ${ROOT}/lib/udev-state ]]
250 then
251 mv -f "${ROOT}"/lib/udev-state/* "${D}"/lib/udev/state/
252 rm -r "${ROOT}"/lib/udev-state
253 fi
254
255 if [[ -f ${ROOT}/etc/udev/udev.config &&
256 ! -f ${ROOT}/etc/udev/udev.rules ]]
257 then
258 mv -f "${ROOT}"/etc/udev/udev.config "${ROOT}"/etc/udev/udev.rules
259 fi
260
261 # delete the old udev.hotplug symlink if it is present
262 if [[ -h ${ROOT}/etc/hotplug.d/default/udev.hotplug ]]
263 then
264 rm -f "${ROOT}"/etc/hotplug.d/default/udev.hotplug
265 fi
266
267 # delete the old wait_for_sysfs.hotplug symlink if it is present
268 if [[ -h ${ROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]]
269 then
270 rm -f "${ROOT}"/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
271 fi
272
273 # delete the old wait_for_sysfs.hotplug symlink if it is present
274 if [[ -h ${ROOT}/etc/hotplug.d/default/10-udev.hotplug ]]
275 then
276 rm -f "${ROOT}"/etc/hotplug.d/default/10-udev.hotplug
277 fi
278
279 # is there a stale coldplug initscript? (CONFIG_PROTECT leaves it behind)
280 coldplug_stale=""
281 if [[ -f ${ROOT}/etc/init.d/coldplug ]]
282 then
283 coldplug_stale="1"
284 fi
285
286 has_version "=${CATEGORY}/${PN}-103-r3"
287 previous_equal_to_103_r3=$?
288
289 has_version "<${CATEGORY}/${PN}-104-r5"
290 previous_less_than_104_r5=$?
291
292 has_version "<${CATEGORY}/${PN}-106-r5"
293 previous_less_than_106_r5=$?
294
295 has_version "<${CATEGORY}/${PN}-113"
296 previous_less_than_113=$?
297 }
298
299 fix_old_persistent_net_rules() {
300 local rules=${ROOT}/etc/udev/rules.d/70-persistent-net.rules
301 [[ -f ${rules} ]] || return
302
303 elog
304 elog "Updating persistent-net rules file"
305
306 # Change ATTRS to ATTR matches, Bug #246927
307 sed -i -e 's/ATTRS{/ATTR{/g' "${rules}"
308
309 # Add KERNEL matches if missing, Bug #246849
310 sed -ri \
311 -e '/KERNEL/ ! { s/NAME="(eth|wlan|ath)([0-9]+)"/KERNEL=="\1*", NAME="\1\2"/}' \
312 "${rules}"
313 }
314
315 # See Bug #129204 for a discussion about restarting udevd
316 restart_udevd() {
317 # need to merge to our system
318 [[ ${ROOT} = / ]] || return
319
320 # check if root of init-process is identical to ours (not in chroot)
321 [[ -r /proc/1/root && /proc/1/root/ -ef /proc/self/root/ ]] || return
322
323 # abort if there is no udevd running
324 [[ -n $(pidof udevd) ]] || return
325
326 # abort if no /dev/.udev exists
327 [[ -e /dev/.udev ]] || return
328
329 elog
330 elog "restarting udevd now."
331
332 killall -15 udevd &>/dev/null
333 sleep 1
334 killall -9 udevd &>/dev/null
335
336 /sbin/udevd --daemon
337 }
338
339 pkg_postinst() {
340 fix_old_persistent_net_rules
341
342 restart_udevd
343
344 if [[ -e "${ROOT}"/etc/runlevels/sysinit && ! -e "${ROOT}"/etc/runlevels/sysinit/udev ]]
345 then
346 ewarn
347 ewarn "You need to add the udev init script to the runlevel sysinit,"
348 ewarn "else your system will not be able to boot"
349 ewarn "after updating to >=openrc-0.4.0"
350 ewarn "Run this to enable udev for >=openrc-0.4.0:"
351 ewarn "\trc-update add udev sysinit"
352 ewarn
353 fi
354
355 # people want reminders, I'll give them reminders. Odds are they will
356 # just ignore them anyway...
357
358 if [[ ${coldplug_stale} == 1 ]]
359 then
360 ewarn "A stale coldplug init script found. You should run:"
361 ewarn
362 ewarn " rc-update del coldplug"
363 ewarn " rm -f /etc/init.d/coldplug"
364 ewarn
365 ewarn "udev now provides its own coldplug functionality."
366 fi
367
368 # delete 40-scsi-hotplug.rules - all integrated in 50-udev.rules
369 if [[ $previous_equal_to_103_r3 = 0 ]] &&
370 [[ -e ${ROOT}/etc/udev/rules.d/40-scsi-hotplug.rules ]]
371 then
372 ewarn "Deleting stray 40-scsi-hotplug.rules"
373 ewarn "installed by sys-fs/udev-103-r3"
374 rm -f "${ROOT}"/etc/udev/rules.d/40-scsi-hotplug.rules
375 fi
376
377 # Removing some device-nodes we thought we need some time ago
378 if [[ -d ${ROOT}/lib/udev/devices ]]
379 then
380 rm -f "${ROOT}"/lib/udev/devices/{null,zero,console,urandom}
381 fi
382
383 # Removing some old file
384 if [[ $previous_less_than_104_r5 = 0 ]]
385 then
386 rm -f "${ROOT}"/etc/dev.d/net/hotplug.dev
387 rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/net 2>/dev/null
388 fi
389
390 if [[ $previous_less_than_106_r5 = 0 ]] &&
391 [[ -e ${ROOT}/etc/udev/rules.d/95-net.rules ]]
392 then
393 rm -f "${ROOT}"/etc/udev/rules.d/95-net.rules
394 fi
395
396 # Try to remove /etc/dev.d as that is obsolete
397 if [[ -d ${ROOT}/etc/dev.d ]]
398 then
399 rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/default "${ROOT}"/etc/dev.d 2>/dev/null
400 if [[ -d ${ROOT}/etc/dev.d ]]
401 then
402 ewarn "You still have the directory /etc/dev.d on your system."
403 ewarn "This is no longer used by udev and can be removed."
404 fi
405 fi
406
407 # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
408 # remove it if user don't has sys-fs/device-mapper installed
409 if [[ $previous_less_than_113 = 0 ]] &&
410 [[ -f ${ROOT}/etc/udev/rules.d/64-device-mapper.rules ]] &&
411 ! has_version sys-fs/device-mapper
412 then
413 rm -f "${ROOT}"/etc/udev/rules.d/64-device-mapper.rules
414 einfo "Removed unneeded file 64-device-mapper.rules"
415 fi
416
417 # requested in Bug #225033:
418 elog
419 elog "persistent-net does assigning fixed names to network devices."
420 elog "If you have problems with the persistent-net rules,"
421 elog "just delete the rules file"
422 elog "\trm ${ROOT}etc/udev/rules.d/70-persistent-net.rules"
423 elog "and then reboot."
424 elog
425 elog "This may however number your devices in a different way than they are now."
426
427 ewarn
428 ewarn "If you build an initramfs including udev, then please"
429 ewarn "make sure that the /sbin/udevadm binary gets included,"
430 ewarn "and your scripts changed to use it,as it replaces the"
431 ewarn "old helper apps udevinfo, udevtrigger, ..."
432
433 ewarn
434 ewarn "mount options for directory /dev are no longer"
435 ewarn "set in /etc/udev/udev.conf, but in /etc/fstab"
436 ewarn "as for other directories."
437
438 elog
439 elog "For more information on udev on Gentoo, writing udev rules, and"
440 elog " fixing known issues visit:"
441 elog " http://www.gentoo.org/doc/en/udev-guide.xml"
442 }