Re: What does last_rule really mean?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sun, 2009-10-25 at 01:45 +0000, Tom Horsley wrote:
> I'm trying to figure out how to write my own udev rules because
> fedora is conveniently switching from hal to udev to control
> things like which disks get automounted by nautilus in a gnome
> session, so I see a lot of docs on the web that recommend
> last_rule as a way to override the system rules.

That advice sounds incredibly busted if you all you want to do is to
control policy. Instead, set udev attributes like DKD_PRESENTATION_*
('man DeviceKit-disks' for details) to control behavior.

(For the record, the last_rule directive in udev is really dangerous as
it may have unintended consequences hiding devices like this from
system-level software depending on it - last time I talked to Kay he
mentioned that it might be nice to remove it since there's really no
reason to hand out rope like that.)

> I'm trying to match the disk with the label "BACKUP", in
> hal, that was simply an attribute I could ask about, in
> udev there does not appear to be a ATTR of any kind that
> will get me the label.
> 
> How can I match the disk label? Can I run a program to
> create a pattern? Any examples?

Here's one example

 # tell the desktop automounter to avoid automounting filesystems with
 # the label "BACKUP"
 ENV{ID_FS_LABEL}=="BACKUP", ENV{DKD_PRESENTATION_NOPOLICY}="1"

You can be more creative here by matching on the device path to e.g.
disable automounting of any partition that is part of a disk plugged
into a given USB port. You can also run your own programs (through
udev's IMPORT{} feature) that can do any kind of calculation they want.
The sky is pretty much the limit.

You can also use DKD_PRESENTATION_HIDE, DKD_PRESENTATION_NAME and
DKD_PRESENTATION_ICON_NAME to control what the icon representing the
filesystem looks like.

Hope this helps.

     David


--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux