linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Matching something against an environment-variable
@ 2007-04-27 11:39 Matthias Schwarzott
  2007-04-30 13:43 ` Kay Sievers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthias Schwarzott @ 2007-04-27 11:39 UTC (permalink / raw)
  To: linux-hotplug

Hi!

I just have noticed that comparisons like this are not possible with udev:

something=ENV{MY_VAR}
or
something="$env{MY_VAR}"

The reason I want to use that is: creating /dev/root without executing a 
program for every blockdev.

With some rule like this:
SUBSYSTEM="block", ATTR{dev}=ENV{ROOT_DEV_NR}, SYMLINK+="root"


with variable ROOT_DEV_NR be either set by 
A. SUBSYSTEM="block", IMPORT{file}+="/dev/.udev/root_dev_nr"
and that file is created by udev-startscript

B. injecting the env-var with
udevcontrol env ROOT_DEV_NR=$(get_root_dev)
after udevd has been started

I think the variant  something=ENV{MY_VAR} should not be too complicated to 
realize.

Matthias

-- 
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Matching something against an environment-variable
  2007-04-27 11:39 Matching something against an environment-variable Matthias Schwarzott
@ 2007-04-30 13:43 ` Kay Sievers
  2007-04-30 14:06 ` Andrey Borzenkov
  2007-04-30 14:09 ` Matthias Schwarzott
  2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2007-04-30 13:43 UTC (permalink / raw)
  To: linux-hotplug

On 4/27/07, Matthias Schwarzott <zzam@gentoo.org> wrote:
> I just have noticed that comparisons like this are not possible with udev:
>
> something=ENV{MY_VAR}

Key names can't appear on the right side, it's always a quoted value.

> or
> something="$env{MY_VAR}"

Right, this version could be made working, but today we don't apply
format chars before we compare the values.

> The reason I want to use that is: creating /dev/root without executing a
> program for every blockdev.
>
> With some rule like this:
> SUBSYSTEM="block", ATTR{dev}=ENV{ROOT_DEV_NR}, SYMLINK+="root"
>
> with variable ROOT_DEV_NR be either set by
> A. SUBSYSTEM="block", IMPORT{file}+="/dev/.udev/root_dev_nr"
> and that file is created by udev-startscript
>
> B. injecting the env-var with
> udevcontrol env ROOT_DEV_NR=$(get_root_dev)
> after udevd has been started
>
> I think the variant  something=ENV{MY_VAR} should not be too complicated to
> realize.

Why don't you write out a 50-rootdev.rules file before starting udevd?
So you don't need to import anything, or match on globel variables:
   SUBSYSTEM="block", ENV{MAJOR}="8", ENV{MINOR}="5", SYMLINK+="root"

Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Matching something against an environment-variable
  2007-04-27 11:39 Matching something against an environment-variable Matthias Schwarzott
  2007-04-30 13:43 ` Kay Sievers
@ 2007-04-30 14:06 ` Andrey Borzenkov
  2007-04-30 14:09 ` Matthias Schwarzott
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Borzenkov @ 2007-04-30 14:06 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 502 bytes --]

On Monday 30 April 2007, Kay Sievers wrote:
>
> Why don't you write out a 50-rootdev.rules file before starting udevd?
> So you don't need to import anything, or match on globel variables:
>    SUBSYSTEM=="block", ENV{MAJOR}=="8", ENV{MINOR}=="5", SYMLINK+="root"
>

At least here udev is started when root is still mounted read-only. Of course 
what is possible, in udev.conf

udev_rules="/dev/.udev/rules.d /etc/udev/rules.d"

and drop rootdev.rules under /dev/.udev/rules.d.

-andrey

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- Attachment #3: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Matching something against an environment-variable
  2007-04-27 11:39 Matching something against an environment-variable Matthias Schwarzott
  2007-04-30 13:43 ` Kay Sievers
  2007-04-30 14:06 ` Andrey Borzenkov
@ 2007-04-30 14:09 ` Matthias Schwarzott
  2 siblings, 0 replies; 4+ messages in thread
From: Matthias Schwarzott @ 2007-04-30 14:09 UTC (permalink / raw)
  To: linux-hotplug

On Montag, 30. April 2007, Kay Sievers wrote:
>
> Why don't you write out a 50-rootdev.rules file before starting udevd?
> So you don't need to import anything, or match on globel variables:
>    SUBSYSTEM="block", ENV{MAJOR}="8", ENV{MINOR}="5", SYMLINK+="root"
>
The problem here is: udev is started before root filesystem is remounted R/W.

At least two solutions to that:
A. Add a symlink in /etc/udev/rules.d/ pointing to somewhere in /dev/.udev/ or 
on any other tmpfs location. And create the file there.

B. Adding some file-inclusion command to udev rule language.

Matthias

-- 
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-30 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-27 11:39 Matching something against an environment-variable Matthias Schwarzott
2007-04-30 13:43 ` Kay Sievers
2007-04-30 14:06 ` Andrey Borzenkov
2007-04-30 14:09 ` Matthias Schwarzott

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).