linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: Re: DEVLINKS and DEVNAME variables in RUN rules
Date: Wed, 25 Jan 2006 18:18:28 +0000	[thread overview]
Message-ID: <200601252118.30655.arvidjaar@mail.ru> (raw)
In-Reply-To: <m3bqy1a91w.fsf@dynamo.mandriva.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 24 January 2006 22:43, Kay Sievers wrote:
> On Tue, Jan 24, 2006 at 09:05:51PM +0300, Andrey Borzenkov wrote:
> > On Tuesday 24 January 2006 19:24, Olivier Blin wrote:
> > > I'd like to use the DEVNAME and DEVLINKS (thanks Kay) environment
> > > variables in a RUN rule. Unfortunately, they're not exported yet when
> > > the command to be executed is computed (i.e. when the format is
> > > applied). So, for now, I'm using a dumb trick:
> > > RUN+="/bin/sh -c '/sbin/pam_console_setowner $$DEVICE $$DEVNAME
> > > $$DEVLINKS'"
> > >
> > > Would it be possible to have the format applied right before the RUN
> > > command is run?
> >
> > Like this? This seems to work for me:
> >
> > Jan 24 21:04:24 cooker udevd-event[16049]: name_list_add: adding
> > '/sbin/pam_console_setowner $env{DEVICE} $env{DEVNAME} $env{DEVLINKS}'
>
> Applied.
>

OK the following patch documents this difference (and the fact that RUN is 
using substitutons at all). I am still curious if there is real life use for 
something like `PROGRAM="check" RUN="callout %c{1}"'.

regards

- -andrey

Subject: [PATCH] Document when substitutions are applied for RUN and other 
keys

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>


- ---

 udev.8 |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

333ee12327b6792c9ba7cb75e89786cd8d5a171c
diff --git a/udev.8 b/udev.8
index 8eb63c2..675bb7e 100644
- --- a/udev.8
+++ b/udev.8
@@ -164,10 +164,15 @@ The 
 \fBNAME\fR, 
 \fBSYMLINK\fR, 
 \fBPROGRAM\fR, 
- -\fBOWNER\fR 
- -and 
+\fBOWNER\fR,
 \fBGROUP\fR 
- -fields support simple printf\-like string substitutions:
+and 
+\fBRUN\fR 
+fields support simple printf\-like string substitutions. For \fBRUN\fR they
+are applied immediately before program is launched, after all rules have
+been processed. It allows use of complete environment set up by earlier rules
+including exported variables. For all other fields substitutions are applied
+when rule is being processed. The supported substitutions are:
 .TP
 \fB$kernel\fR, \fB%k\fR
 The kernel name for this device.
- -- 
1.1.4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD18D1R6LMutpd94wRAqMgAJ9DVxZeZ5OFjIfPm8kWVEt8auVX9ACfbBod
UwcVMW+MOoKSBfsbjP8+Ugs÷pb
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2006-01-25 18:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-24 16:24 DEVLINKS and DEVNAME variables in RUN rules Olivier Blin
2006-01-24 18:05 ` Andrey Borzenkov
2006-01-24 19:43 ` Kay Sievers
2006-01-25 18:18 ` Andrey Borzenkov [this message]
2006-01-25 18:25 ` Olivier Blin
2006-01-25 18:52 ` Kay Sievers
2006-01-25 19:03 ` Andrey Borzenkov
2006-01-25 19:10 ` Kay Sievers
2006-01-25 19:38 ` Andrey Borzenkov
2006-01-26  1:18 ` 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=200601252118.30655.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --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).