Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/udev-gentoo-scripts:master commit in: helpers/, init.d/, /
Date: Tue, 31 Dec 2013 05:28:07
Message-Id: 1388463308.d2e712f832cc81db8e35c964991ea3bab7a4b0f0.williamh@gentoo
1 commit: d2e712f832cc81db8e35c964991ea3bab7a4b0f0
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 29 03:56:12 2013 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 31 04:15:08 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/udev-gentoo-scripts.git;a=commit;h=d2e712f8
7
8 Move code from dev-root-link helper to udev init script
9
10 This code should only be run by the udev init script, so let's put it
11 inside the script instead of making it a helper.
12
13 X-Gentoo-Bug: 495086
14 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=495086
15
16 ---
17 Makefile | 1 -
18 helpers/dev-root-link.sh | 22 ----------------------
19 init.d/udev | 19 ++++++++++++++++++-
20 3 files changed, 18 insertions(+), 24 deletions(-)
21
22 diff --git a/Makefile b/Makefile
23 index d631832..b1739ed 100644
24 --- a/Makefile
25 +++ b/Makefile
26 @@ -9,7 +9,6 @@ CONFD ?= $(SYSCONFDIR)/conf.d
27 INITD ?= $(SYSCONFDIR)/init.d
28
29 HELPERS = \
30 - helpers/dev-root-link.sh \
31 helpers/net.sh
32
33 all:
34
35 diff --git a/helpers/dev-root-link.sh b/helpers/dev-root-link.sh
36 deleted file mode 100644
37 index b92c47e..0000000
38 --- a/helpers/dev-root-link.sh
39 +++ /dev/null
40 @@ -1,22 +0,0 @@
41 -#!/bin/sh -e
42 -#
43 -# dev-root-link.sh: create /dev/root symlink
44 -#
45 -# Distributed under the terms of the GNU General Public License v2
46 -#
47 -# This is here because some software expects /dev/root to exist.
48 -# For more information, see this bug:
49 -# https://bugs.gentoo.org/show_bug.cgi?id=438380
50 -
51 -RULESDIR=/run/udev/rules.d
52 -
53 -[ -d $RULESDIR ] || mkdir -p $RULESDIR
54 -
55 -eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ || true)
56 -
57 -[ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || exit 0
58 -
59 -# btrfs filesystems have bogus major/minor numbers
60 -[ "$ROOT_MAJOR" != 0 ] || exit 0
61 -
62 -echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
63
64 diff --git a/init.d/udev b/init.d/udev
65 index 0e9abfe..c861338 100644
66 --- a/init.d/udev
67 +++ b/init.d/udev
68 @@ -93,11 +93,28 @@ start_udevmonitor()
69 --background --exec /bin/udevadm -- monitor ${udev_monitor_opts}
70 }
71
72 +# This is here because some software expects /dev/root to exist.
73 +# For more information, see this bug:
74 +# https://bugs.gentoo.org/show_bug.cgi?id=438380
75 +dev_root_link()
76 +{
77 + local RULESDIR=/run/udev/rules.d
78 + [ -d $RULESDIR ] || mkdir -p $RULESDIR
79 + eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
80 + true)
81 + [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0
82 +
83 + # btrfs filesystems have bogus major/minor numbers
84 + [ "$ROOT_MAJOR" != 0 ] || return 0
85 +
86 + echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
87 +}
88 +
89 populate_dev()
90 {
91 if yesno ${rc_dev_root_symlink:-yes}; then
92 ebegin "Generating a rule to create a /dev/root symlink"
93 - /lib/udev/dev-root-link.sh
94 + dev_root_link
95 eend $?
96 fi