[systemd-devel] Pairing udev's SYSTEMD_WANTS and systemd's templated units

Michael Biebl mbiebl at gmail.com
Thu Jul 31 15:06:49 PDT 2014


I suggested something like this in [1] but in the end a systemd-escape
utility was added [2].

Since you can't use ENV to set dynamic variables, you might do that
via a RUN rule instead.

HTH,
Michael

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747044#25
[2] http://lists.freedesktop.org/archives/systemd-devel/2014-July/021050.html

2014-07-31 14:55 GMT+02:00 Ivan Shapovalov <intelfx100 at gmail.com>:
> Hello all,
>
> I'm trying to start from an udev rule a templated systemd unit, whose instance
> should be a properly escaped device node path (so that %i.device would represent
> an existing unit). Which udev specifier should I use for this?
>
> Or, in more clear wording:
>
> given the rule:
>
> ACTION=="add", ..., TAG+="systemd", ENV{SYSTEMD_WANTS}+="foo@$some_specifier.service"
>
> and the unit foo at .service:
>
> [Unit]
> After=%i.device
> BindsTo=%i.device
> ...
>
> Which $some_specifier should I use in the udev rule to get %i.device in
> my service file to refer to the valid and corresponding device unit?
>
> The closest match I've got is "sys%p", but it does not work because dashes are not
> escaped, and I get
> "sys-devices-pci0000:00-0000:00:1d.0-usb4-4-1-4-1.2.device"
> instead of
> "sys-devices-pci0000:00-0000:00:1d.0-usb4-4\x2d1-4\x2d1.2.device"
> and so on.
>
> Thanks,
> --
> Ivan Shapovalov / intelfx /
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


More information about the systemd-devel mailing list