All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Joshua Watt" <JPEWhacker@gmail.com>
To: "François GOUDAL" <francois.goudal@airmont.com>,
	"yocto@lists.yoctoproject.org" <yocto@lists.yoctoproject.org>
Subject: Re: [yocto] Making a recipe that enables a systemd service it doesn't provide
Date: Thu, 27 May 2021 09:30:42 -0500	[thread overview]
Message-ID: <3029a0c6-2a35-4ce3-8643-335baa21ba90@gmail.com> (raw)
In-Reply-To: <4DC83B72-2CFE-4F0B-B5A8-9100C502535E@airmont.com>

[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]

It might be easier to manually enable the service with a symbolic link 
instead of using systemd.bbclass with something like:

do_install() {

   install -Dm 755 ${D}${systemd_unitdir}/system/multi-user.target.wants/

   ln -s ${systemd_unitdir}/system/openvpn@.service 
${D}${systemd_unitdir}/system/multi-user.target.wants/openvpn@test.service

}

NOTE: I didn't explicitly test this

On 5/27/21 9:17 AM, François GOUDAL wrote:
> Hello,
>
> I am struggling with something I couldn’t find any solution for so far.
>
> I am trying to make a very simple recipe that does this:
> - Drop an openvpn configuration file in /etc/openvpn/test.conf
> - Make the systemd service openvpn@test.service enabled by default
>
> The recipe itself depends on openvpn, and so, it doesn’t, by itself, provide the openvpn@.service , which comes with openvpn.
>
> Dropping the openvpn configuration file in the rootfs is easy, but I can’t manage to make the recipe to enable the service.
> I’ve tried adding this to my recipe:
>
> inherit systemd
> SYSTEMD_AUTO_ENABLE = "enable"
> SYSTEMD_SERVICE_${PN} = "openvpn@test.service"
>
> But bitbake fails on this recipe with the message below:
>
> ERROR: test-openvpn-config-1.0-r0 do_package: SYSTEMD_SERVICE_test-openvpn-config value openvpn@test.service does not exist
>
> I believe this is caused by the fact that the service file is not part of the files installed by the recipe itself, but it is not meant to be anyway.
>
> Is there a (clean) way to achieve this ?
>
> Thanks in advance
>
>
>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 2702 bytes --]

      parent reply	other threads:[~2021-05-27 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 14:17 Making a recipe that enables a systemd service it doesn't provide François GOUDAL
2021-05-27 14:27 ` [yocto] " Quentin Schulz
2021-05-27 14:30 ` Joshua Watt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3029a0c6-2a35-4ce3-8643-335baa21ba90@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=francois.goudal@airmont.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.