diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-24 08:01:31 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-24 08:01:31 +0000 |
commit | b70981b68efcce5256eb11c6cd26ae123b10b6ea (patch) | |
tree | a38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/udev/write_root_link_rule | |
parent | 2b4df81538b8398442d5296650905c70341dd8d3 (diff) | |
download | aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2 aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz |
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/udev/write_root_link_rule')
-rwxr-xr-x | main/udev/write_root_link_rule | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/main/udev/write_root_link_rule b/main/udev/write_root_link_rule new file mode 100755 index 0000000000..8eaea11769 --- /dev/null +++ b/main/udev/write_root_link_rule @@ -0,0 +1,29 @@ +#!/bin/sh +# +# This script should run before doing udevtrigger at boot. +# It will create a rule matching the device directory / is on, and +# creating /dev/root symlink pointing on its device node. +# +# This is especially useful for hal looking at /proc/mounts containing +# a line listing /dev/root as device: +# /dev/root / reiserfs rw 0 0 +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation version 2 of the License. +# +# (c) 2007-2008 Matthias Schwarzott <zzam@gentoo.org> + +eval $(udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/) + +[ $? = 0 ] || exit 0 +[ "$ROOT_MAJOR" = 0 ] && exit 0 + +DIR=/dev/.udev/rules.d +[ -d "$DIR" ] || mkdir -p "$DIR" +RULES=$DIR/10-root-link.rules + +echo "# Created by /lib/udev/write_root_link_rule" > "${RULES}" +echo "# This rule should create /dev/root as link to real root device." >> "${RULES}" +echo "SUBSYSTEM==\"block\", ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", SYMLINK+=\"root\"" >> "${RULES}" + |