Magellan Linux

Annotation of /tags/udev-173-r1/write_root_link_rule.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 516 - (hide annotations) (download) (as text)
Sat Mar 22 18:13:36 2008 UTC (16 years, 1 month ago) by niro
Original Path: trunk/udev/write_root_link_rule.sh
File MIME type: application/x-sh
File size: 1163 byte(s)
-new file; merged with upstream udev-119 rules

1 niro 516 #!/bin/sh
2     # $Header: /root/magellan-cvs/src/udev/write_root_link_rule.sh,v 1.1 2008-03-22 18:13:36 niro Exp $
3     #
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     # (c) 2007 Matthias Schwarzott <zzam@gentoo.org>
17    
18     DEV=$(udevadm info --device-id-of-file=/)
19     if [ $? = 0 ]; then
20     MAJOR="${DEV% *}"
21     MINOR="${DEV#* }"
22    
23     [ -d /dev/.udev/rules.d ] || mkdir -p /dev/.udev/rules.d
24     RULES=/dev/.udev/rules.d/10-root-link.rules
25    
26     echo "# Created by /lib/udev/write_root_link_rule" > "${RULES}"
27     echo "# This rule should create /dev/root as link to real root device." >> "${RULES}"
28     echo "SUBSYSTEM==\"block\", ENV{MAJOR}==\"$MAJOR\", ENV{MINOR}==\"$MINOR\", SYMLINK+=\"root\"" >> "${RULES}"
29     fi