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