title: Yocto SYSTEMD_SERVICE to install a parameterized service ("@.service")
body: <p>I need to configure WireGuard to bring up a VPN on boot on an Embedded Linux device.</p>
  
  <p>My recipe installs a <code>/etc/wireguard/wg0.conf</code> pretty much like the examples found through the Internet.</p>
  
  <p>Then I try to enable the service on SystemD like this on my <code>wireguard.bb</code>:</p>
  
  <pre><code>SYSTEMD_SERVICE = "wg-quick@wg0.service"
  SYSTEMD_AUTO_ENABLE = "enable"
  </code></pre>
  
  <p>But <code>bitbake</code> throws me an error:</p>
  
  <pre><code>ERROR: Function failed: SYSTEMD_SERVICE_my-conf value wg-quick@wg0.service does not exist
  </code></pre>
  
  <p>I checked the temporary directory and file <code>wg0.conf</code> appears in the correct places but it seems that bitbake's <code>SYSTEMD_SERVICE</code> doesn't know how to expand the "wg0" after <code>@</code> sign.</p>
  
  <p>If I try <strong>without</strong> the interface name (<code>wg0</code>):</p>
  
  <pre><code>SYSTEMD_SERVICE = "wg-quick@.service"
  </code></pre>
  
  <p>Bitbake is happy and finalizes my recipe, but it is not what <code>systemd</code> is expecting. Starting a service without an interface makes no sense...</p>
  
  <hr>
  
  <p>Then I tried another approach and split the "wireguard" package itself from the configuration ("wireguard-conf" package) and added <code>DEPENDS</code> and <code>RDEPENDS</code> on "wireguard".</p>
  
  <p>This got even worse since my <code>wireguard-conf.bb</code> recipe does not contain a "wg-quick@.service" file (it comes from the dependency "wireguard").</p>
  
  <hr>
  
  <p>Well,</p>
  
  <p>I don't know how to properly fix it and any suggestions will be highly appreciated.</p>
  
  <hr>
  
  <p><strong>Additional Info</strong></p>
  
  <p>I am using Yocto 2.0.3 in this project (with no hope of updating it).</p>
  
  <p>Thanks to @TomasNovotny comments I managed to compare my "systemd.bbclas" against Github and noticed a change in <code>systemd_populate_packages()</code> that seems to solve the problem.</p>