-   Linux - Software (
-   -   need help with udev rule (

hussam 12-04-2006 04:16 PM

need help with udev rule
In a udev rule, I added PROGRAM="something"
Now, instead of KERNEL=="hdc", how do I make KERNEL== the output of PROGRAM?
This is necessary since hdc don't always point to the device in question. something it is hdd depending on output of PROGRAM. Is this even possible to write into a udev rule?
Any help is greatly appreciated.

Andrew Benton 12-04-2006 05:01 PM

You can't assign the kernel name (the name that the kernel has give to the device). You can assign the NAME.
`==' is a logical operator, the test for equality used to test whether two variables have the same value.
`=' is the operator you should use to assign a value to a variable.
If you want to assign the device name to be the result of the program you should use something like


hussam 12-05-2006 04:30 AM

Another problem
For some reason /dev/hda1 mounted as root (/) isn't being symlinked to /dev/root
( /dev/hda1 -> /dev/root symlink is missing )

The rule:

KERNEL=="hda1" , SYMLINK:="root"
works perfectly but this is bad since it hardcodes hda1 into the rule.
They suggested I do:


SUBSYSTEM=="ide", PROGRAM="/bin/sh -c 'mount | grep \"%k on /\" | cut -d\" \" -f1'", SYMLINK+="%c"
SUBSYSTEM=="scsi", PROGRAM="/bin/sh -c 'mount | grep \"%k on /\" | cut -d\" \" -f1'", SYMLINK+="%c"

but that rule doesn't seem to work. Any idea? I just want a udev rule that symlinks whatever device is mounted as / to /dev/root.

All times are GMT -5. The time now is 07:51 PM.