Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 461940 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/sys-fs/udev/udev-200.ebuild (-57 / +207 lines)
Lines 1-6 Link Here
1
# Copyright 1999-2013 Gentoo Foundation
1
# Copyright 1999-2013 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-200.ebuild,v 1.15 2013/04/04 12:53:32 ssuominen Exp $
3
# $Header: $
4
4
5
EAPI=5
5
EAPI=5
6
6
Lines 11-30 Link Here
11
	KV_min=2.6.32
11
	KV_min=2.6.32
12
fi
12
fi
13
13
14
inherit autotools eutils linux-info multilib toolchain-funcs versionator
14
inherit autotools eutils linux-info multilib systemd toolchain-funcs versionator flag-o-matic
15
15
16
if [[ ${PV} = 9999* ]]; then
16
if [[ ${PV} = 9999* ]]; then
17
	EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd"
17
	EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd"
18
	inherit git-2
18
	inherit git-2
19
else
19
else
20
	patchset=1
20
	patchset= #3
21
	SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz"
21
	SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz"
22
	if [[ -n "${patchset}" ]]; then
22
	if [[ -n "${patchset}" ]]; then
23
				SRC_URI="${SRC_URI}
23
				SRC_URI="${SRC_URI}
24
					http://dev.gentoo.org/~ssuominen/${P}-patches-${patchset}.tar.xz
24
					http://dev.gentoo.org/~ssuominen/${P}-patches-${patchset}.tar.xz
25
					http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.xz"
25
					http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.xz"
26
			fi
26
			fi
27
	KEYWORDS="alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 sh sparc x86"
27
	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
28
fi
28
fi
29
29
30
DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
30
DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
Lines 32-38 Link Here
32
32
33
LICENSE="LGPL-2.1 MIT GPL-2"
33
LICENSE="LGPL-2.1 MIT GPL-2"
34
SLOT="0"
34
SLOT="0"
35
IUSE="acl doc +firmware-loader gudev hwdb introspection keymap +kmod +openrc selinux static-libs"
35
IUSE="acl doc firmware-loader gudev hwdb introspection keymap +kmod +openrc selinux static-libs logind"
36
36
37
RESTRICT="test"
37
RESTRICT="test"
38
38
Lines 43-53 Link Here
43
	kmod? ( >=sys-apps/kmod-12 )
43
	kmod? ( >=sys-apps/kmod-12 )
44
	selinux? ( >=sys-libs/libselinux-2.1.9 )
44
	selinux? ( >=sys-libs/libselinux-2.1.9 )
45
	!<sys-libs/glibc-2.11
45
	!<sys-libs/glibc-2.11
46
	!sys-apps/systemd"
46
	!<sys-apps/systemd-${PV}"
47
47
48
DEPEND="${COMMON_DEPEND}
48
DEPEND="${COMMON_DEPEND}
49
	app-text/docbook-xsl-stylesheets
50
	dev-libs/libxslt
51
	virtual/os-headers
49
	virtual/os-headers
52
	virtual/pkgconfig
50
	virtual/pkgconfig
53
	!<sys-kernel/linux-headers-${KV_min}
51
	!<sys-kernel/linux-headers-${KV_min}
Lines 56-61 Link Here
56
54
57
if [[ ${PV} = 9999* ]]; then
55
if [[ ${PV} = 9999* ]]; then
58
	DEPEND="${DEPEND}
56
	DEPEND="${DEPEND}
57
		app-text/docbook-xsl-stylesheets
58
		dev-libs/libxslt
59
		dev-util/gperf
59
		dev-util/gperf
60
		>=dev-util/intltool-0.50"
60
		>=dev-util/intltool-0.50"
61
fi
61
fi
Lines 76-83 Link Here
76
76
77
S=${WORKDIR}/systemd-${PV}
77
S=${WORKDIR}/systemd-${PV}
78
78
79
#QA_MULTILIB_PATHS="lib/systemd/systemd-udevd"
80
81
udev_check_KV() {
79
udev_check_KV() {
82
	if kernel_is lt ${KV_min//./ }; then
80
	if kernel_is lt ${KV_min//./ }; then
83
		return 1
81
		return 1
Lines 127-133 Link Here
127
		fi
125
		fi
128
126
129
		# gperf disable if keymaps are not requested wrt bug #452760
127
		# gperf disable if keymaps are not requested wrt bug #452760
130
		if ! [[ $(grep -i gperf Makefile.am | wc -l) -eq 27 ]]; then
128
	if ! [[ $(grep -i gperf Makefile.am | wc -l) -eq 27 ]]; then
131
			eerror "The line count for gperf references failed, see bug 452760"
129
			eerror "The line count for gperf references failed, see bug 452760"
132
			die
130
			die
133
		fi
131
		fi
Lines 140-146 Link Here
140
138
141
	# These are missing from upstream 50-udev-default.rules
139
	# These are missing from upstream 50-udev-default.rules
142
	cat <<-EOF > "${T}"/40-gentoo.rules
140
	cat <<-EOF > "${T}"/40-gentoo.rules
143
	# Gentoo specific usb group
141
	# see src_prepare() for content of these files
144
	SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
142
	SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
145
	# Keep this for Linux 2.6.32 kernels with accept4() support like .60 wrt #457868
143
	# Keep this for Linux 2.6.32 kernels with accept4() support like .60 wrt #457868
146
	SUBSYSTEM=="mem", KERNEL=="null|zero|full|random|urandom", MODE="0666"
144
	SUBSYSTEM=="mem", KERNEL=="null|zero|full|random|urandom", MODE="0666"
Lines 163-174 Link Here
163
	version_is_at_least 4.6 $(gcc-version) || \
161
	version_is_at_least 4.6 $(gcc-version) || \
164
		sed -i 's:static_assert:alsdjflkasjdfa:' src/shared/macro.h
162
		sed -i 's:static_assert:alsdjflkasjdfa:' src/shared/macro.h
165
163
164
	find . -type f -name "*.[hc]" -exec sed -i.ori 's:/cgroup/systemd:/cgroup/daemon:g' {} +
165
	find . -type f -name "*.[hc]" -exec sed -i.ori 's:/run/systemd:/var/run/systemd:g' {} +
166
	find . -type f -name "*.[hc]" -exec sed -i.ori 's:name=systemd:name=daemon:g' {} +
167
	find . -type f -name "*.[hc]" -exec sed -i.ori 's:systemd-udevd:udevd:g' {} +
168
	find . -type f -name "*.[hc]" -exec sed -i.ori 's:/run/udev:/var/run/udev:g' {} +
169
	#epatch "${FILESDIR}/${P}"-run-to-var.patch || die
170
171
	epatch "${FILESDIR}/${PN}"-198-logind.patch || die
172
	epatch "${FILESDIR}/${PN}"-198-nosystemd-daemon-makefile.patch || die
173
166
	# change rules back to group uucp instead of dialout for now wrt #454556
174
	# change rules back to group uucp instead of dialout for now wrt #454556
167
	sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
175
	sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
168
		-i rules/*.rules \
176
		-i rules/*.rules \
169
	|| die "failed to change group dialout to uucp"
177
	|| die "failed to change group dialout to uucp"
170
178
171
	if [[ ! -e configure ]]; then
179
	if ! use elibc_glibc; then #443030
180
		echo '#define secure_getenv(x) NULL' >> config.h.in
181
		sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die
182
	fi
183
184
	if [ ! -e configure ]; then
172
		if use doc; then
185
		if use doc; then
173
			gtkdocize --docdir docs || die "gtkdocize failed"
186
			gtkdocize --docdir docs || die "gtkdocize failed"
174
		else
187
		else
Lines 178-210 Link Here
178
	else
191
	else
179
		check_default_rules
192
		check_default_rules
180
		elibtoolize
193
		elibtoolize
181
	fi
194
		eautomake
182
183
	if ! use elibc_glibc; then #443030
184
		echo '#define secure_getenv(x) NULL' >> config.h.in
185
		sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die
186
	fi
195
	fi
187
196
188
	# link udevd(8) to systemd-udevd.service(8) manpage
197
	# link udevd(8) to systemd-udevd.service(8) manpage
189
	echo '.so systemd-udevd.service.8' > "${T}"/udevd.8
198
	#echo '.so systemd-udevd.service.8' > "${T}"/udevd.8
190
}
199
}
191
200
192
src_configure() {
201
src_configure() {
193
	tc-export CC #463846
194
	use keymap || export ac_cv_path_GPERF=true #452760
202
	use keymap || export ac_cv_path_GPERF=true #452760
195
203
204
	# alternative: systemd daemon NOPs when -DDISABLE_SYSTEMD is set
205
	# also not for logind, but does not harm.
206
207
	append-cppflags -DDISABLE_SYSTEMD
208
196
	local econf_args
209
	local econf_args
210
	use logind && CPPFLAGS="${CPPFLAGS} -DDISABLE_SD_DAEMON"
197
211
198
	econf_args=(
212
	econf_args=(
199
		ac_cv_search_cap_init=
200
		ac_cv_header_sys_capability_h=yes
201
		DBUS_CFLAGS=' '
202
		DBUS_LIBS=' '
203
		--bindir=/bin
213
		--bindir=/bin
204
		--docdir=/usr/share/doc/${PF}
214
		--docdir=/usr/share/doc/${PF}
205
		--libdir=/usr/$(get_libdir)
215
		--libdir=/$(get_libdir)
216
		--libexecdir=/lib
217
		--prefix=/
218
		--exec-prefix=/
219
		--includedir=/usr/include
220
		--datarootdir=/usr/share
221
		--localstatedir=/var
222
		--with-dbuspolicydir=/usr/dbus-1/system.d
223
		--libdir=/$(get_libdir)
206
		--with-html-dir=/usr/share/doc/${PF}/html
224
		--with-html-dir=/usr/share/doc/${PF}/html
207
		--with-rootprefix=
225
		--with-rootprefix=/
208
		--with-rootlibdir=/$(get_libdir)
226
		--with-rootlibdir=/$(get_libdir)
209
		--with-bashcompletiondir=/usr/share/bash-completion
227
		--with-bashcompletiondir=/usr/share/bash-completion
210
		--without-python
228
		--without-python
Lines 214-220 Link Here
214
		--disable-ima
232
		--disable-ima
215
		--disable-libcryptsetup
233
		--disable-libcryptsetup
216
		--disable-localed
234
		--disable-localed
217
		--disable-logind
235
		$(use_enable logind)
236
		--disable-efi
237
		--disable-chkconfig
238
		--disable-xattr
239
		--disable-gcrypt
240
		--disable-qrencode
241
		--disable-microhttpd
242
		--disable-binfmt
243
		--disable-vconsole
244
		--disable-bootchart
245
		--disable-randomseed
246
		--enable-blkid
218
		--disable-myhostname
247
		--disable-myhostname
219
		--disable-nls
248
		--disable-nls
220
		--disable-pam
249
		--disable-pam
Lines 224-229 Link Here
224
		--disable-tcpwrap
253
		--disable-tcpwrap
225
		--disable-timedated
254
		--disable-timedated
226
		--disable-xz
255
		--disable-xz
256
		--disable-silent-rules
227
		--disable-polkit
257
		--disable-polkit
228
		$(use_enable acl)
258
		$(use_enable acl)
229
		$(use_enable doc gtk-doc)
259
		$(use_enable doc gtk-doc)
Lines 233-262 Link Here
233
		$(use_enable selinux)
263
		$(use_enable selinux)
234
		$(use_enable static-libs static)
264
		$(use_enable static-libs static)
235
	)
265
	)
266
236
	if use introspection; then
267
	if use introspection; then
237
		econf_args+=(
268
		econf_args+=(
238
			--enable-introspection=$(usex introspection)
269
			--enable-introspection=$(usex introspection)
239
		)
270
		)
240
	fi
271
	fi
272
241
	if use firmware-loader; then
273
	if use firmware-loader; then
242
		econf_args+=(
274
		econf_args+=(
243
			--with-firmware-path="/lib/firmware/updates:/lib/firmware"
275
			--with-firmware-path=/lib/firmware/updates:/lib/firmware
276
		)
277
	fi
278
279
	if ! use logind; then
280
		econf_args+=(
281
			DBUS_CFLAGS=' '
282
			DBUS_LIBS=' '
283
			ac_cv_search_cap_init=
284
			ac_cv_header_sys_capability_h=yes
244
		)
285
		)
245
	fi
286
	fi
246
	econf "${econf_args[@]}"
287
	econf "${econf_args[@]}" ${CPPFLAGS:+CPPFLAGS="${CPPFLAGS}"}
247
}
288
}
248
289
249
src_compile() {
290
src_compile() {
250
	echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra
291
	echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra
251
	emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES
292
	emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES
252
	local pretargets=(
253
		libsystemd-shared.la
254
		libudev-private.la
255
		libudev.la
256
	)
257
	local targets=(
293
	local targets=(
294
		libudev-private.la
258
		systemd-udevd
295
		systemd-udevd
259
		udevadm
296
		udevadm
297
		libudev.la
260
		ata_id
298
		ata_id
261
		cdrom_id
299
		cdrom_id
262
		collect
300
		collect
Lines 269-279 Link Here
269
		man/systemd-udevd.8
307
		man/systemd-udevd.8
270
		man/systemd-udevd.service.8
308
		man/systemd-udevd.service.8
271
	)
309
	)
310
	if use logind; then
311
		targets+=(
312
			systemd-logind
313
			loginctl
314
			man/loginctl.1
315
			man/systemd-logind.8
316
		)
317
	fi
272
	use keymap && targets+=( keymap )
318
	use keymap && targets+=( keymap )
273
	use gudev && targets+=( libgudev-1.0.la )
319
	use gudev && targets+=( libgudev-1.0.la )
274
320
275
	emake "${pretargets[@]}"
321
	emake udevlibexecdir=/$(get_libdir)/udev "${targets[@]}"
276
	emake "${targets[@]}"
277
	if use doc; then
322
	if use doc; then
278
		emake -C docs/libudev
323
		emake -C docs/libudev
279
		use gudev && emake -C docs/gudev
324
		use gudev && emake -C docs/gudev
Lines 291-304 Link Here
291
		install-binPROGRAMS
336
		install-binPROGRAMS
292
		install-rootlibexecPROGRAMS
337
		install-rootlibexecPROGRAMS
293
		install-udevlibexecPROGRAMS
338
		install-udevlibexecPROGRAMS
339
		install-dist_systemunitDATA
294
		install-dist_udevconfDATA
340
		install-dist_udevconfDATA
295
		install-dist_udevhomeSCRIPTS
341
		install-dist_udevhomeSCRIPTS
296
		install-dist_udevkeymapDATA
342
		install-dist_udevkeymapDATA
297
		install-dist_udevkeymapforcerelDATA
343
		install-dist_udevkeymapforcerelDATA
298
		install-dist_udevrulesDATA
344
		install-dist_udevrulesDATA
299
		install-girDATA
345
		install-girDATA
346
		install-man3
300
		install-man7
347
		install-man7
301
		install-man8
348
		install-man8
349
		install-nodist_systemunitDATA
302
		install-pkgconfiglibDATA
350
		install-pkgconfiglibDATA
303
		install-sharepkgconfigDATA
351
		install-sharepkgconfigDATA
304
		install-typelibsDATA
352
		install-typelibsDATA
Lines 308-313 Link Here
308
		install-dist_bashcompletionDATA
356
		install-dist_bashcompletionDATA
309
	)
357
	)
310
358
359
	if use logind; then
360
		targets+=(
361
			install-pkgincludeHEADERS
362
			libsystemd-login-install-hook
363
			install-man1
364
			install-man5
365
			install-nodist_udevrulesDATA
366
			install-dist_dbuspolicyDATA
367
	)
368
		pkgconfiglib_DATA+=" src/login/libsystemd-login.pc"
369
		lib_LTLIBRARIES+=" libsystemd-login.la"
370
	fi
371
311
	if use gudev; then
372
	if use gudev; then
312
		lib_LTLIBRARIES+=" libgudev-1.0.la"
373
		lib_LTLIBRARIES+=" libgudev-1.0.la"
313
		pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
374
		pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
Lines 315-332 Link Here
315
376
316
	# add final values of variables:
377
	# add final values of variables:
317
	targets+=(
378
	targets+=(
379
		udevlibexecdir=/lib/udev
318
		rootlibexec_PROGRAMS=systemd-udevd
380
		rootlibexec_PROGRAMS=systemd-udevd
319
		bin_PROGRAMS=udevadm
381
		bin_PROGRAMS=udevadm
320
		lib_LTLIBRARIES="${lib_LTLIBRARIES}"
382
		lib_LTLIBRARIES="${lib_LTLIBRARIES}"
321
		MANPAGES="man/udev.7 man/udevadm.8 \
383
		MANPAGES="man/udev.7 man/udevadm.8 \
322
				man/systemd-udevd.service.8"
384
				man/systemd-udevd.service.8"
323
		MANPAGES_ALIAS="man/systemd-udevd.8"
385
		MANPAGES_ALIAS="man/systemd-udevd.8"
386
		dist_systemunit_DATA="units/systemd-udevd-control.socket \
387
				units/systemd-udevd-kernel.socket"
388
		nodist_systemunit_DATA="units/systemd-udevd.service \
389
				units/systemd-udev-trigger.service \
390
				units/systemd-udev-settle.service"
324
		pkgconfiglib_DATA="${pkgconfiglib_DATA}"
391
		pkgconfiglib_DATA="${pkgconfiglib_DATA}"
392
		systemunitdir="$(systemd_get_unitdir)"
325
		INSTALL_DIRS='$(sysconfdir)/udev/rules.d \
393
		INSTALL_DIRS='$(sysconfdir)/udev/rules.d \
326
				$(sysconfdir)/udev/hwdb.d'
394
				$(sysconfdir)/udev/hwdb.d'
327
		dist_bashcompletion_DATA="shell-completion/bash/udevadm"
395
		dist_bashcompletion_DATA="shell-completion/bash/udevadm"
396
328
	)
397
	)
398
	if use logind; then
399
		targets+=(
400
			dist_pkgsysconf_DATA+="src/login/logind.conf"
401
			rootlibexec_PROGRAMS+="systemd-logind"
402
			bin_PROGRAMS+="loginctl"
403
			MANPAGES+="man/loginctl.1 man/logind.conf.5"
404
		)
405
	fi
329
	emake -j1 DESTDIR="${D}" "${targets[@]}"
406
	emake -j1 DESTDIR="${D}" "${targets[@]}"
407
330
	if use doc; then
408
	if use doc; then
331
		emake -C docs/libudev DESTDIR="${D}" install
409
		emake -C docs/libudev DESTDIR="${D}" install
332
		use gudev && emake -C docs/gudev DESTDIR="${D}" install
410
		use gudev && emake -C docs/gudev DESTDIR="${D}" install
Lines 338-355 Link Here
338
		"${D}"/lib/udev/rules.d/99-systemd.rules \
416
		"${D}"/lib/udev/rules.d/99-systemd.rules \
339
		"${D}"/usr/share/doc/${PF}/LICENSE.*
417
		"${D}"/usr/share/doc/${PF}/LICENSE.*
340
418
341
	# see src_prepare() for content of these files
419
	# install gentoo-specific rules
342
	insinto /lib/udev/rules.d
420
	insinto /lib/udev/rules.d
343
	doins "${T}"/40-gentoo.rules
421
	doins "${T}"/40-gentoo.rules
344
	doman "${T}"/udevd.8
345
422
346
	# install udevadm compatibility symlink
423
	dodir /usr/$(get_libdir)
347
	dosym {../bin,sbin}/udevadm
424
	mv ${D:-:}/$(get_libdir)/pkgconfig ${D}/usr/$(get_libdir)
425
426
	gen_usr_ldscript libudev.so
427
428
	dodir /sbin
429
430
	if [ -x ${D}/bin/udevadm ]; then
431
		mv ${D}/bin/udevadm ${D}/sbin/udevadm
432
	fi
433
	# udevadm is now in /usr/bin. <--- I can't believe it !!
434
	dosym /sbin/udevadm /bin/udevadm
435
436
	dodir /$(get_libdir)/udev
437
438
	# move udevd where it should be and remove unlogical /lib/systemd
439
	mv "${ED}"/lib/systemd/systemd-udevd "${ED}"/sbin/udevd || die
440
	rm -r "${ED}"/lib/systemd
441
	rm -r "${ED}"/usr/lib/systemd
442
443
	# create symlinks for these utilities to /sbin
444
	# where multipath-tools expect them to be (Bug #168588)
445
	dosym /lib/udev/scsi_id /sbin/scsi_id
446
447
	dosym /var/run /run
448
	mv ${D}/usr/share/man/man8/systemd-udevd.service.8 ${D}/usr/share/man/man8/udevd.8
348
449
349
	# install udevd to /sbin and remove empty and redudant directory
450
	rm ${D}/usr/share/man/man8/systemd-udevd.8
350
	# /lib/systemd because systemd is installed to /usr wrt #462750
451
351
	mv "${D}"/{lib/systemd/systemd-,sbin/}udevd || die
452
	local manuals
352
	rm -r "${D}"/lib/systemd
453
	if use logind; then
454
		manuals="man5/logind.conf.5 man1/loginctl.1"
455
	fi
456
457
	local man
458
	for man in man7/udevd.7 man8/udevd.8 man8/udevadm.8 ${manuals}; do
459
		sed -i 's:\\fBsystem.*\\fR(1),::' ${D}/usr/share/man/${man}
460
		sed -i 's:systemd-\([^\.]*\)\.service:\1:g' ${D}/usr/share/man/${man}
461
		sed -i 's:systemd\\-::g' ${D}/usr/share/man/${man}
462
		sed -i '/^\.TH/s:systemd:version:' ${D}/usr/share/man/${man}
463
	done
464
465
	# see src_prepare() where this is created
466
	#doman "${T}"/udevd.8
467
468
	if use logind; then
469
#		rm -f "${D}"/usr/dbus-1/system.d/org.freedesktop.systemd1.conf
470
		exeinto /$(get_libdir)/udev
471
		doexe  ./.libs/systemd-logind
472
		mv ${D}/$(get_libdir)/udev/systemd-logind ${D}/sbin/logind
473
		insinto /etc/systemd
474
		doins src/login/logind.conf
475
	fi
353
}
476
}
354
477
355
pkg_preinst() {
478
pkg_preinst() {
Lines 366-378 Link Here
366
	preserve_old_lib /{,usr/}$(get_libdir)/libudev$(get_libname 0)
489
	preserve_old_lib /{,usr/}$(get_libdir)/libudev$(get_libname 0)
367
}
490
}
368
491
492
# This function determines if a directory is a mount point.
493
# It was lifted from dracut.
494
ismounted() {
495
	while read a m a; do
496
		[[ $m = $1 ]] && return 0
497
	done < "${ROOT}"/proc/mounts
498
	return 1
499
}
500
369
pkg_postinst() {
501
pkg_postinst() {
370
	mkdir -p "${ROOT}"run
502
	mkdir -p "${ROOT}"/run
371
503
372
	# "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
504
	# "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
373
	# So try to remove it here (will only work if empty).
505
	# So try to remove it here (will only work if empty).
374
	rmdir "${ROOT}"dev/loop 2>/dev/null
506
	rmdir "${ROOT}"/dev/loop 2>/dev/null
375
	if [[ -d ${ROOT}dev/loop ]]; then
507
	if [[ -d ${ROOT}/dev/loop ]]; then
376
		ewarn "Please make sure your remove /dev/loop,"
508
		ewarn "Please make sure your remove /dev/loop,"
377
		ewarn "else losetup may be confused when looking for unused devices."
509
		ewarn "else losetup may be confused when looking for unused devices."
378
	fi
510
	fi
Lines 388-394 Link Here
388
		einfo "Removed unneeded file ${old_dm_rules}"
520
		einfo "Removed unneeded file ${old_dm_rules}"
389
	fi
521
	fi
390
522
391
	local fstab="${ROOT}"etc/fstab dev path fstype rest
523
	if ismounted /usr; then
524
		ewarn
525
		ewarn "Your system has /usr on a separate partition. This means"
526
		ewarn "you will need to use an initramfs to pre-mount /usr before"
527
		ewarn "udev runs."
528
		ewarn
529
		ewarn "If this is not set up before your next reboot, udev may work;"
530
		ewarn "However, you also may experience failures which are very"
531
		ewarn "difficult to troubleshoot."
532
		ewarn
533
		ewarn "For a more detailed explanation, see the following URL:"
534
		ewarn "http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken"
535
		ewarn
536
		ewarn "For more information on setting up an initramfs, see the"
537
		ewarn "following URL:"
538
		ewarn "http://www.gentoo.org/doc/en/initramfs-guide.xml"
539
	fi
540
541
	local fstab="${ROOT}"/etc/fstab dev path fstype rest
392
	while read -r dev path fstype rest; do
542
	while read -r dev path fstype rest; do
393
		if [[ ${path} == /dev && ${fstype} != devtmpfs ]]; then
543
		if [[ ${path} == /dev && ${fstype} != devtmpfs ]]; then
394
			ewarn "You need to edit your /dev line in ${fstab} to have devtmpfs"
544
			ewarn "You need to edit your /dev line in ${fstab} to have devtmpfs"
Lines 397-403 Link Here
397
		fi
547
		fi
398
	done < "${fstab}"
548
	done < "${fstab}"
399
549
400
	if [[ -d ${ROOT}usr/lib/udev ]]; then
550
	if [[ -d ${ROOT}/usr/lib/udev ]]; then
401
		ewarn
551
		ewarn
402
		ewarn "Please re-emerge all packages on your system which install"
552
		ewarn "Please re-emerge all packages on your system which install"
403
		ewarn "rules and helpers in /usr/lib/udev. They should now be in"
553
		ewarn "rules and helpers in /usr/lib/udev. They should now be in"
Lines 408-414 Link Here
408
		ewarn "Note that qfile can be found in app-portage/portage-utils"
558
		ewarn "Note that qfile can be found in app-portage/portage-utils"
409
	fi
559
	fi
410
560
411
	local old_net_name="${ROOT}"etc/udev/rules.d/80-net-name-slot.rules
561
	local old_net_name="${ROOT}"/etc/udev/rules.d/80-net-name-slot.rules
412
	if [[ -f ${old_net_name} ]]; then
562
	if [[ -f ${old_net_name} ]]; then
413
		local old_net_sum=bebf4bd1b6b668e9ff34a3999aa6ff32
563
		local old_net_sum=bebf4bd1b6b668e9ff34a3999aa6ff32
414
		MD5=$(md5sum < "${old_net_name}")
564
		MD5=$(md5sum < "${old_net_name}")
Lines 420-427 Link Here
420
		fi
570
		fi
421
	fi
571
	fi
422
572
423
	local old_cd_rules="${ROOT}"etc/udev/rules.d/70-persistent-cd.rules
573
	local old_cd_rules="${ROOT}"/etc/udev/rules.d/70-persistent-cd.rules
424
	local old_net_rules="${ROOT}"etc/udev/rules.d/70-persistent-net.rules
574
	local old_net_rules="${ROOT}"/etc/udev/rules.d/70-persistent-net.rules
425
	for old_rules in "${old_cd_rules}" "${old_net_rules}"; do
575
	for old_rules in "${old_cd_rules}" "${old_net_rules}"; do
426
		if [[ -f ${old_rules} ]]; then
576
		if [[ -f ${old_rules} ]]; then
427
			ewarn
577
			ewarn
Lines 445-451 Link Here
445
	ewarn "(replace <ifname> with, for example, eth0):"
595
	ewarn "(replace <ifname> with, for example, eth0):"
446
	ewarn "# udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null"
596
	ewarn "# udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null"
447
	ewarn
597
	ewarn
448
	ewarn "You can use kernel commandline net.ifnames=0 to disable this feature."
598
	ewarn "You can use kernel command net.ifnames= to control this feature."
449
599
450
	ewarn
600
	ewarn
451
	ewarn "You need to restart udev as soon as possible to make the upgrade go"
601
	ewarn "You need to restart udev as soon as possible to make the upgrade go"
Lines 455-467 Link Here
455
	preserve_old_lib_notify /{,usr/}$(get_libdir)/libudev$(get_libname 0)
605
	preserve_old_lib_notify /{,usr/}$(get_libdir)/libudev$(get_libname 0)
456
606
457
	elog
607
	elog
458
	elog "For more information on udev on Gentoo, upgrading, writing udev rules, and"
608
	elog "For more information on udev on Gentoo, writing udev rules, and"
459
	elog "         fixing known issues visit:"
609
	elog "         fixing known issues visit:"
460
	elog "         http://wiki.gentoo.org/wiki/Udev/upgrade"
461
	elog "         http://www.gentoo.org/doc/en/udev-guide.xml"
610
	elog "         http://www.gentoo.org/doc/en/udev-guide.xml"
462
611
463
	# Update hwdb database in case the format is changed by udev version.
612
	# Keep this here in case the database format changes so it gets updated
464
	if use hwdb && has_version 'sys-apps/hwids[udev]'; then
613
	# when required. Despite that this file is owned by sys-apps/hwids.
614
	if use hwdb && has_version sys-apps/hwids; then
465
		udevadm hwdb --update --root="${ROOT%/}"
615
		udevadm hwdb --update --root="${ROOT%/}"
466
	fi
616
	fi
467
}
617
}

Return to bug 461940