<html>
<head>
</head>
<body>
<div style="color: black;">
<div style="color: black;">
<p style="margin: 0 0 1em 0; color: black;">Have you tried just connecting like I said before? systemd's D-Bus activation will make sure whichever polkit service is started once you try to connect to it. This is really the way you should handle it.  </p>
<p style="margin: 0 0 1em 0; color: black;">That being said, for future reference, to start a potentially nonexistent service first, you can try:</p>
<p style="margin: 0 0 1em 0; color: black;">After=polkitd polkit</p>
</div>
<div style="color: black;">
<p style="color: black; font-size: 10pt; font-family: Arial, sans-serif; margin: 8pt 0;">On June 30, 2018 3:11:10 AM Federico Di Pierro <nierro92@gmail.com> wrote:</p>
<blockquote type="cite" class="gmail_quote" style="margin: 0 0 0 0.75ex; border-left: 1px solid #808080; padding-left: 0.75ex;">
<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff">Hi Ryan,</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff">thanks for your answer!</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff">The issue is that some old distributions (ubuntu 16.04) had polkitd.service, while new ones have polkit.service.  <br>How can I specify a "Requires=" on both? Obviously one of them will fail depending on system, thus my own service will fail too.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:#0000ff">Thank you very much,</div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Federico</div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr">Il giorno sab 30 giu 2018 alle ore 00:10 Ryan Gonzalez <<a href="mailto:rymg19@gmail.com">rymg19@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>
<div style="color:black">
<div style="color:black">
<p style="margin:0 0 1em 0;color:black">systemd can depend on services, not bus names. In your example, you'd want:</p>
<p style="margin:0 0 1em 0;color:black">Wants=polkit</p>
<p style="margin:0 0 1em 0;color:black">However, in most cases, you don't actually want to do this; if the service (in this case, polkit) tells systemd what bus name it is going to ask for, systemd will automatically wait when your service asks for it. </p>
<p style="margin:0 0 1em 0;color:black">For instance, the moment your service tries to connect to org.freedesktop.PolicyKit1, systemd will wait for polkit to start before letting your service continue. </p>
</div>
<div style="color:black">
<p style="color:black;font-size:10pt;font-family:Arial,sans-serif;margin:8pt 0">On June 29, 2018 4:44:27 PM Federico Di Pierro <<a href="mailto:nierro92@gmail.com" target="_blank">nierro92@gmail.com</a>> wrote:</p>
<blockquote type="cite" class="gmail_quote" style="margin:0 0 0 0.75ex;border-left:1px solid #808080;padding-left:0.75ex">
<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,255)">Hi everyone!<br><br>I was wondering whether there was a way for a systemd service to wait for a bus name to appear before starting a service.</div><div class="gmail_default"><font color="#0000ff" face="verdana, sans-serif">Something like:</font><br><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></span></span></div><div class="gmail_default"><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Requires=org.freedesktop.PolicyKit1</span><br></span><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,255)"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I could not find much googling around.</span><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,255)">Is this possible? </div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,255)">Thanks everyone!</div><div><div dir="ltr" class="m_-4451779465866533619gmail_signature"><div dir="ltr"><div><div dir="ltr">Federico</div></div></div></div></div></div>

_______________________________________________<br>
systemd-devel mailing list<br>
<a class="m_-4451779465866533619aqm-autolink m_-4451779465866533619aqm-autowrap" href="mailto:systemd-devel%40lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a class="m_-4451779465866533619aqm-autolink m_-4451779465866533619aqm-autowrap" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote>
</div>
</div>
</div>

</blockquote></div>
</blockquote>
</div>
</div>
</body>
</html>