https://wiki.merproject.org/wiki/index.php?title=Systemd&feed=atom&action=historySystemd - Revision history2024-03-28T12:28:12ZRevision history for this page on the wikiMediaWiki 1.19.20+dfsg-2.3https://wiki.merproject.org/wiki/index.php?title=Systemd&diff=3690&oldid=prevLbt: userunitdir and /etc notes2013-06-18T13:25:32Z<p>userunitdir and /etc notes</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 13:25, 18 June 2013</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 9:</td>
<td colspan="2" class="diff-lineno">Line 9:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  %{_unitdir}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>  %{_unitdir}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del class="diffchange diffchange-inline">User session units need</del>:</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">In preparation for next version</ins>:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>  %define _userunitdir <del class="diffchange diffchange-inline">%{_libdir}</del>/systemd/user/</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>  %define _userunitdir <ins class="diffchange diffchange-inline">/usr/lib</ins>/systemd/user/</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Note that no units should ever be installed into /etc/</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">and install user units to:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> %{_userunitdir}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Note that no units should ever be installed into /etc/ <ins class="diffchange diffchange-inline">although the installation macros will create symlinks there.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.</div></td></tr>
<!-- diff cache key wiki_merproject_db:diff:version:1.11a:oldid:3680:newid:3690 -->
</table>Lbthttps://wiki.merproject.org/wiki/index.php?title=Systemd&diff=3680&oldid=prevLbt: correct use of %systemd_postun and add link2013-06-17T13:26:02Z<p>correct use of %systemd_postun and add link</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 13:26, 17 June 2013</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 33:</td>
<td colspan="2" class="diff-lineno">Line 33:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>For services that don't support a restart (eg if clients have stateful connections) then use:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>For services that don't support a restart (eg if clients have stateful connections) then use:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>   %systemd_postun <del class="diffchange diffchange-inline">my.service</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>   %systemd_postun</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div> </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed.</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 45:</td>
<td colspan="2" class="diff-lineno">Line 44:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd <ins class="diffchange diffchange-inline">also http://www.freedesktop.org/software/systemd/man/daemon.html</ins></div></td></tr>
</table>Lbthttps://wiki.merproject.org/wiki/index.php?title=Systemd&diff=3679&oldid=prevLbt: Initial version2013-06-16T18:41:21Z<p>Initial version</p>
<p><b>New page</b></p><div>Currently Mer packages require systemd in the build phase to use the systemd macros. This may change.<br />
<br />
Until then your spec/yaml should contain:<br />
<br />
BuildRequires: systemd<br />
<br />
System units should be installed to:<br />
<br />
%{_unitdir}<br />
<br />
User session units need:<br />
%define _userunitdir %{_libdir}/systemd/user/<br />
<br />
Note that no units should ever be installed into /etc/<br />
<br />
Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.<br />
<br />
<br />
All the %preun %post and %postun macros must be provided.<br />
<br />
The %preun macro is simply<br />
<br />
%systemd_preun my.service<br />
<br />
The %post macro<br />
<br />
%systemd_post my.service<br />
<br />
The %postun is typically<br />
<br />
%systemd_postun_with_restart my.service<br />
<br />
For services that don't support a restart (eg if clients have stateful connections) then use:<br />
<br />
%systemd_postun my.service<br />
<br />
<br />
These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed.<br />
Packages *must not* install preset files - the vendor should provide these.<br />
<br />
=== References ===<br />
<br />
The macros definitions can be found at http://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in<br />
<br />
This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html<br />
<br />
Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd</div>Lbt