Annotation of /trunk/udev/write_root_link_rule.sh
Parent Directory | Revision Log
Revision 1329 -
(hide annotations)
(download)
(as text)
Fri May 27 13:54:05 2011 UTC (13 years, 4 months ago) by niro
Original Path: tags/udev-171-r1/write_root_link_rule.sh
File MIME type: application/x-sh
File size: 1185 byte(s)
Fri May 27 13:54:05 2011 UTC (13 years, 4 months ago) by niro
Original Path: tags/udev-171-r1/write_root_link_rule.sh
File MIME type: application/x-sh
File size: 1185 byte(s)
tagged 'udev-171-r1'
1 | niro | 516 | #!/bin/sh |
2 | niro | 716 | # $Header: /root/magellan-cvs/src/udev/write_root_link_rule.sh,v 1.2 2008-12-22 20:30:09 niro Exp $ |
3 | niro | 516 | # |
4 | # This script should run before doing udevtrigger at boot. | ||
5 | # It will create a rule matching the device directory / is on, and | ||
6 | # creating /dev/root symlink pointing on its device node. | ||
7 | # | ||
8 | # This is especially useful for hal looking at /proc/mounts containing | ||
9 | # a line listing /dev/root as device: | ||
10 | # /dev/root / reiserfs rw 0 0 | ||
11 | # | ||
12 | # This program is free software; you can redistribute it and/or modify it | ||
13 | # under the terms of the GNU General Public License as published by the | ||
14 | # Free Software Foundation version 2 of the License. | ||
15 | # | ||
16 | niro | 716 | # (c) 2007-2008 Matthias Schwarzott <zzam@gentoo.org> |
17 | niro | 516 | |
18 | niro | 716 | eval $(udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/) |
19 | niro | 516 | |
20 | niro | 716 | [ $? = 0 ] || exit 0 |
21 | [ "$ROOT_MAJOR" = 0 ] && exit 0 | ||
22 | niro | 516 | |
23 | niro | 716 | DIR=/dev/.udev/rules.d |
24 | [ -d "$DIR" ] || mkdir -p "$DIR" | ||
25 | RULES=$DIR/10-root-link.rules | ||
26 | |||
27 | echo "# Created by /lib/udev/write_root_link_rule" > "${RULES}" | ||
28 | echo "# This rule should create /dev/root as link to real root device." >> "${RULES}" | ||
29 | echo "SUBSYSTEM==\"block\", ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", SYMLINK+=\"root\"" >> "${RULES}" |