linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Zeuthen <david@fubar.dk>
To: linux-hotplug@vger.kernel.org
Subject: Re: What does last_rule really mean?
Date: Sun, 25 Oct 2009 02:20:20 +0000	[thread overview]
Message-ID: <1256437220.9119.17.camel@localhost.localdomain> (raw)
In-Reply-To: <102520090145.1929.4AE3ADC2000828BF0000078922243322829B0A02D29B9B0EBF970A049C9D0108D203019B@att.net>

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



  reply	other threads:[~2009-10-25  2:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25  1:45 What does last_rule really mean? Tom Horsley
2009-10-25  2:20 ` David Zeuthen [this message]
2009-10-25 14:08 ` Tom Horsley
2009-10-25 17:51 ` Kay Sievers
2009-10-25 19:05 ` Tom Horsley
2009-10-28 10:52 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1256437220.9119.17.camel@localhost.localdomain \
    --to=david@fubar.dk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).