LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-04-2006, 03:16 PM   #1
hussam
LQ Newbie
 
Registered: Feb 2006
Distribution: Archlinux
Posts: 8

Rep: Reputation: 0
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.
 
Old 12-04-2006, 04:01 PM   #2
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
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
Code:
KERNEL=="hdc", PROGRAM="SOMETHING", NAME="%c"
 
Old 12-05-2006, 03:30 AM   #3
hussam
LQ Newbie
 
Registered: Feb 2006
Distribution: Archlinux
Posts: 8

Original Poster
Rep: Reputation: 0
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:
Code:
KERNEL=="hda1" , SYMLINK:="root"
works perfectly but this is bad since it hardcodes hda1 into the rule.
They suggested I do:

Code:
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.

Last edited by hussam; 12-05-2006 at 03:42 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
udev rule for usbstick Steve50 Slackware 5 10-13-2006 05:53 AM
Udev rule required for scsi scanner samac Slackware 2 10-07-2006 10:32 AM
udev-Rule for Mobile tuxangler Linux - Hardware 1 03-28-2006 05:41 AM
Making a udev rule for sonypi blimbo Linux - Software 4 03-01-2006 07:48 PM
Issues with adding a udev rule... Ateo Linux - General 1 03-04-2005 08:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration