Hello openembedded-core developers,


We are using systemd service files that use instance name to configure their 
WantedBy dependency. The names of the services could be 
[email protected]<mailto:[email protected]> or 
[email protected]<mailto:[email protected]> – the 
[email protected]<mailto:[email protected]> is a template systemd service that reference 
the instance using “%i” in the [Install] section.



[Install]

WantedBy=%i.target



Expected behavior: When enabling [email protected], WantedBy=%i.target is 
replaced as WantedBy=multi-user.target because the 
[email protected]’s<mailto:[email protected]%E2%80%99s> instance name 
is “multi-user”. And the enable script would then create a symlink from 
/etc/systemd/system/multi-user.target.wants/[email protected] -> 
/usr/lib/systemd/system/[email protected]



Actual behavior: When using openembedded-core’s native systemctl script for 
enabling [email protected] during a yocto build, the %i is not replaced. 
The symlink created is 
/etc/systemd/system/%i.target.wants/[email protected] -> 
/usr/lib/systemd/system/[email protected]



Currently, for Yocto’s systemctl script to replace the “%i” with instance, the 
first character after WantedBy= must not be a “%” character. The regex used is 
in 
https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-core/systemd/systemd-systemctl/systemctl#L205
 (pasting the github mirror link because the normal git repo is inaccessible at 
my end currently).


It seems like faulty behavior from my perspective. 
Systemd.unit<https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers>
 man page does not mention any restriction about having “%i” be the first 
pattern after WantedBy=, and systemd’s systemctl program currently allows 
WantedBy=%i.target.



Thank you,

Eric

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206035): 
https://lists.openembedded.org/g/openembedded-core/message/206035
Mute This Topic: https://lists.openembedded.org/mt/109075726/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to