[yocto] Enable systemd service with parameter

Maciej Pijanowski maciej.pijanowski at 3mdeb.com
Sun Nov 17 12:43:46 PST 2019


On 17.11.2019 20:44, Mateusz Majchrzycki wrote:
> Hi!
Hi,
> I have a pretty unusual problem. I need to enable a systemd service 
> (openvpn) with a profile as a parameter (typically you do it by 
> 'systemctl enable openvpn at profile'). But the profile on build time 
> doesn't exist (it is just symlink to non existing file).
> My recipe bb looks like (I'm omitting SUMMARY etc.):
>
> inherit systemd
> SYSTEMD_SERVICE_${PN} = "openvpn at clientprofile.service"
> SYSTEMD_AUTO_ENABLE = "enable"
> DEPENDS = "openvpn"
> SYSTEMD_PACKAGES = "${PN}"
>
> do_install() {
> install -d ${D}${sysconfdir}/openvpn/
> ln -sf /data/etc/openvpn/clientprofile.conf 
> ${D}${sysconfdir}/openvpn/clientprofile.conf
> }
>
> Unfortunately, on build I get the following error:
> ERROR: openvpn-client-1.0-r3 do_package: 
> SYSTEMD_SERVICE_openvpn-client value openvpn at clientprofile.service 
> does not exist
> ERROR: openvpn-client-1.0-r3 do_package: Function failed: 
> systemd_populate_packages
>
> What am I doing wrong? I suppose the symlink is not a problem as 
> normally systemctl enables service with non-existent file as a 
> parameter (it fails on start, but not enabling).
Maybe you could just create that file 
/data/etc/openvpn/clientprofile.conf and install it within the recipe?
It can be even empty. The service will keep failing. The build shall 
pass. Sounds reasonable?
>
> Best regards,
> Mateusz
>
>
-- 
Maciej Pijanowski
Embedded Systems Engineer
https://3mdeb.com | @3mdeb_com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20191117/23366424/attachment.html>


More information about the yocto mailing list