summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--conf.d/udev9
-rw-r--r--helpers/dev-root-link.sh22
-rw-r--r--init.d/udev10
4 files changed, 42 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 67d40e7..7d146df 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ CONFD ?= $(SYSCONFDIR)/conf.d
INITD ?= $(SYSCONFDIR)/init.d
HELPERS = \
+ helpers/dev-root-link.sh \
helpers/net.sh
all:
diff --git a/conf.d/udev b/conf.d/udev
index 667cc8b..41f6b9b 100644
--- a/conf.d/udev
+++ b/conf.d/udev
@@ -11,6 +11,15 @@
# in /etc/conf.d/rc: rc_plug_services="!*"
#rc_coldplug="YES"
+# We can create a /dev/root symbolic link to point to the root device in
+# some situations. This is on by default because some software relies on
+# it,. However, this software should be fixed to not do this.
+# For more information, see
+# https://bugs.gentoo.org/show_bug.cgi?id=438380.
+# If you are not using any affected software, you do not need this, so
+# feel free to turn it off.
+#rc_dev_root_symlink="YES"
+
# Expert options:
# Timeout in seconds to wait for processing of uevents at boot.
diff --git a/helpers/dev-root-link.sh b/helpers/dev-root-link.sh
new file mode 100644
index 0000000..b92c47e
--- /dev/null
+++ b/helpers/dev-root-link.sh
@@ -0,0 +1,22 @@
+#!/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 a2f0ec1..09b59e9 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -95,6 +95,16 @@ start_udevmonitor()
populate_dev()
{
+ if yesno ${rc_dev_root_symlink:-yes}; then
+ einfo "The following is a temporary fix because some software"
+ einfo "depends on the existence of /dev/root."
+ einfo "For more information, see the following bug:"
+ einfo "https://bugs.gentoo.org/show_bug.cgi?id=438380"
+ ebegin "Generating a rule to create /dev/root symlink"
+ /lib/udev/dev-root-link.sh
+ eend $?
+ fi
+
get_bootparam "nocoldplug" && rc_coldplug="no"
if ! yesno ${rc_coldplug:-${RC_COLDPLUG:-yes}}; then
einfo "Setting /dev permissions and symbolic links"