[systemd-devel] udev rules environment variable
Robert Milasan
rmilasan at suse.com
Tue Dec 17 09:57:00 PST 2013
On Tue, 17 Dec 2013 17:36:21 +0100
"Kay Sievers" <kay at vrfy.org> wrote:
> On Tue, Dec 17, 2013 at 2:05 PM, Robert Milasan <rmilasan at suse.com>
> wrote:
> > 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.
>
> KERNEL is the device name in /sys, without the leading path. It is in
> almost all cases also the name in /dev, but there are some
> differences. And right, it is always set, there is never a point to do
> such a match.
>
> > Even without the KERNEL== doesn't seem to work:
>
> It's pointless to match that, so it should not make a difference.
>
> > 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)
> > rmmod e1000 (REMOVE event, get the test_device value)
> >
> > This doesn't seem to work, or at least it looks like that.
>
> How old is your udev? You are not possibly talking about years old
> versions, right?
>
> Kay
>
The tests are run using udev 208 (systemd 208).
--
Robert Milasan
L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: rmilasan at suse.com
GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A
More information about the systemd-devel
mailing list