linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: william <william@cobradevil.org>
To: linux-hotplug@vger.kernel.org
Subject: udev rule matching using ENV
Date: Tue, 26 Jul 2011 19:15:02 +0000	[thread overview]
Message-ID: <4E2F1236.8050500@cobradevil.org> (raw)

Dear list

i am trying to create a udev rule which executes a script whenever a usb 
stick is removed with a particular uuid

The uuid is changeable and we have a common settings file which exports 
the UUID from the usb partition.

What i would like is to import the UUID from the settings file and match 
that with the actual ID_FS_UUID with the remove action.

So i created 99-remove-usb.rules with the following contents

IMPORT{program}="/usr/local/bin/usb-stick-uuid.sh"
ACTION="remove", ENV{ID_FS_UUID}="ENV{MY_UUID}", 
RUN+="/usr/local/bin/usb-removed.sh"

The program usb-stick-uuid.sh now only echo's:
MY_UUIDÿ744c66-3671-447c-8fa0-d96fc6f82352
and nothing else.
But it does never match.

When i enter the uuid by hand in the rule it does work:
ACTION="remove", 
ENV{ID_FS_UUID}="ff744c66-3671-447c-8fa0-d96fc6f82352", 
RUN+="/usr/local/bin/usb-removed.sh"

Am i doing something wrong or is it just the way it works? I also could 
not find any example on the internet matching two ENV strings.

My system:
ubuntu 10.10
udev version 162


             reply	other threads:[~2011-07-26 19:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26 19:15 william [this message]
2011-07-26 19:18 ` udev rule matching using ENV william
2011-07-26 20:35 ` Kay Sievers
2011-07-27  4:48 ` william

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=4E2F1236.8050500@cobradevil.org \
    --to=william@cobradevil.org \
    --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).