diff options
author | William Hubbs <williamh@gentoo.org> | 2013-03-21 10:05:15 -0500 |
---|---|---|
committer | William Hubbs <williamh@gentoo.org> | 2013-03-21 10:05:15 -0500 |
commit | ba463c6841c2cd0ab58aac391bd84613694cb7a9 (patch) | |
tree | 261d6f933cb7057b6c04781f4e9524b93f414227 /helpers/dev-root-link.sh | |
parent | re-arrange variable settings (diff) | |
download | udev-gentoo-scripts-ba463c6841c2cd0ab58aac391bd84613694cb7a9.tar.gz udev-gentoo-scripts-ba463c6841c2cd0ab58aac391bd84613694cb7a9.tar.bz2 udev-gentoo-scripts-ba463c6841c2cd0ab58aac391bd84613694cb7a9.zip |
Optionally create /dev/root symlink
This is being added because there is software in our tree which hard
codes the reference to /dev/root instead of using stat("/") to retrieve
the root device. It is temporary however and will be removed again once
this software is fixed.
This is based on a patch submitted by Samuli Ssuominen.
X-Gentoo-Bug: 438380
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=438380
Diffstat (limited to 'helpers/dev-root-link.sh')
-rw-r--r-- | helpers/dev-root-link.sh | 22 |
1 files changed, 22 insertions, 0 deletions
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 |