summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2013-12-28 21:56:12 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-12-30 22:15:08 -0600
commitd2e712f832cc81db8e35c964991ea3bab7a4b0f0 (patch)
tree971078cff542e5e22dc3ec6c902c7cafa8725e1c /init.d/udev
parentstart work on version 27 (diff)
downloadudev-gentoo-scripts-d2e712f832cc81db8e35c964991ea3bab7a4b0f0.tar.gz
udev-gentoo-scripts-d2e712f832cc81db8e35c964991ea3bab7a4b0f0.tar.bz2
udev-gentoo-scripts-d2e712f832cc81db8e35c964991ea3bab7a4b0f0.zip
Move code from dev-root-link helper to udev init script
This code should only be run by the udev init script, so let's put it inside the script instead of making it a helper. X-Gentoo-Bug: 495086 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=495086
Diffstat (limited to 'init.d/udev')
-rw-r--r--init.d/udev19
1 files changed, 18 insertions, 1 deletions
diff --git a/init.d/udev b/init.d/udev
index 0e9abfe..c861338 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -93,11 +93,28 @@ start_udevmonitor()
--background --exec /bin/udevadm -- monitor ${udev_monitor_opts}
}
+# This is here because some software expects /dev/root to exist.
+# For more information, see this bug:
+# https://bugs.gentoo.org/show_bug.cgi?id=438380
+dev_root_link()
+{
+ local RULESDIR=/run/udev/rules.d
+ [ -d $RULESDIR ] || mkdir -p $RULESDIR
+ eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
+ true)
+ [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0
+
+ # btrfs filesystems have bogus major/minor numbers
+ [ "$ROOT_MAJOR" != 0 ] || return 0
+
+ echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
+}
+
populate_dev()
{
if yesno ${rc_dev_root_symlink:-yes}; then
ebegin "Generating a rule to create a /dev/root symlink"
- /lib/udev/dev-root-link.sh
+ dev_root_link
eend $?
fi