[systemd-devel] udev rules environment variable

Andrey Borzenkov arvidjaar at gmail.com
Tue Dec 17 08:49:32 PST 2013


В Tue, 17 Dec 2013 14:05:56 +0100
Robert Milasan <rmilasan at suse.com> пишет:

> On Tue, 17 Dec 2013 13:54:34 +0100
> "Martin Pitt" <martin.pitt at ubuntu.com> wrote:
> 
> > Robert Milasan [2013-12-17 12:44 +0100]:
> > > I have this rule as a test, but doesn't do squat (meaning it doesnt
> > > work) :)
> > > 
> > > ACTION=="add", SUBSYSTEM=="net", KERNEL=="?*", ENV{test_device}="1"
> > > 
> > > ACTION=="remove", SUBSYSTEM=="net", KERNEL=="?*",
> > > ENV{test_device}=="1", RUN+="/bin/sh -c 'echo test_device
> > > > /tmp/test_device.log'"
> > 
> > Drop the KERNEL== bits. Network devices don't have a /dev/... device
> > node in Linux, so KERNEL will never be set for those.
> > 
> > Martin
> 
> Even without the KERNEL== doesn't seem to work:
> 
> I'm testing this by first removing the network device (ex. rmmod
> e1000), so I can have first an ADD event and then a REMOVE event, by
> removing again the module, so:
> 
> rmmod e1000 (remove first)
> modprobe e1000 (ADD event, set the test_device var to 1)

You miss MOVE event ... as was explained it does not import existing
environment by default ...

> rmmod e1000 (REMOVE event, get the test_device value)
> 
> This doesn't seem to work, or at least it looks like that.
> 



More information about the systemd-devel mailing list