Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev: Why has OPTIONS="last_rule" been removed?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
fsavigny
n00b
n00b


Joined: 08 Sep 2012
Posts: 24

PostPosted: Sun Dec 09, 2012 9:28 am    Post subject: udev: Why has OPTIONS="last_rule" been removed? Reply with quote

Dear forum,

I am trying to write udev rules for my various external USB flash (pen) drives and hard disks. While I have now grasped how I always assign the same device node (or symlink) to any specific device, I have not yet figured out how to write "default" rules, in the following sense:

1st rule: if the device is my one and only USB Toshiba xxx hard drive with serial number 24F66G242, always create the symlink /dev/sd_my_toshiba%n

2nd rule: if it is any other USB block device, always create the symlink /dev/sd_anyother%n


I want the 2nd rule to be applied when the first rule does not apply, i.e. make it the default rule. But what happens is that the Toshiba will get assigned /dev/sd_my_toshiba%n AND /dev/sd_anyother%n, because obviously, it is also "any" USB block device (there seems no way of expressing "any other").

I have just found out that in the past, I could simply have added OPTIONS="last_rule" to the first rule, and then the second rule would not have been examined if the first rule matched. The whole WWW sphere seems to be happily using this option, even on recent pages. However, in the udev manpage on my system, "last_rule" does not figure, and the ChangeLog tells me that it has been removed as early as when the version changed from v146 to v147 (or something like that). I'm currently on v171-r9.

Is there any way to get "last_rule" back? Or is there any other way to achieve what I want?

Thanks so much in advance,

Florian
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Dec 09, 2012 10:14 am    Post subject: Reply with quote

Can use GOTO. Some examples:
Code:
grep GOTO /lib/udev/rules.d/*
Back to top
View user's profile Send private message
fsavigny
n00b
n00b


Joined: 08 Sep 2012
Posts: 24

PostPosted: Tue Dec 11, 2012 5:56 pm    Post subject: Reply with quote

Thank you so much!

I realize that OPTIONS="last_rule" can be emulated with GOTO="end", provided there is a LABEL="end" in the end.

It's strange they don't mention this in the manpage, since so much advice on the web mentions OPTIONS="last_rule".

Again, thanks a much! You solved a very annoying problem for me.

Florian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum