[systemd-devel] udev rules environment variable

Hannes Reinecke hare at suse.de
Tue Dec 17 02:58:21 PST 2013


On 12/17/2013 11:52 AM, Kay Sievers wrote:
> On Tue, Dec 17, 2013 at 8:56 AM, Hannes Reinecke <hare at suse.de> wrote:
>> On 12/17/2013 08:52 AM, Robert Milasan wrote:
>>> Hello,
>>>   got a small question about creating a rule, like this:
>>>
>>> ACTION=="add", ...., ENV{test_device}="1"
>>>
>>> ACTION=="remove, ...., ENV{test_device}=="1",
>>> RUN+="/path/to/some/script"
>>>
>>> Does udev save test_device variable someplace and then it can be used
>>> later on, when have ACTION=="remove" ?
> 
>> Typically not.
> 
> There is a standard REMOVE_CMD in 95-udev-late.rules to use for this
> 
> All variables are stored in the database and are contained in the
> "remove" event, without the need to be added or queried. Sysfs though
> is not available, all of it is gone at "remove".
> 
Ah.

Curious.

So 'remove' contains the environment variables set from the 'add' event?

What about the 'change' event?

I would have thought the same rule applies to this one, but
experience shows that 'change' events have to generate the same
environment variables as the 'add' event.
Otherwise unexpected results happen ...

So why are the environment variables / db entries not merged
into the 'change' environment?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare at suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


More information about the systemd-devel mailing list