diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | helpers/dev-root-link.sh | 22 | ||||
-rw-r--r-- | init.d/udev | 19 |
3 files changed, 18 insertions, 24 deletions
@@ -9,7 +9,6 @@ CONFD ?= $(SYSCONFDIR)/conf.d INITD ?= $(SYSCONFDIR)/init.d HELPERS = \ - helpers/dev-root-link.sh \ helpers/net.sh all: diff --git a/helpers/dev-root-link.sh b/helpers/dev-root-link.sh deleted file mode 100644 index b92c47e..0000000 --- a/helpers/dev-root-link.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e -# -# dev-root-link.sh: create /dev/root symlink -# -# Distributed under the terms of the GNU General Public License v2 -# -# 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 - -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" ] || exit 0 - -# btrfs filesystems have bogus major/minor numbers -[ "$ROOT_MAJOR" != 0 ] || exit 0 - -echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules 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 |