The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


Systemd

From Mer Wiki
(Difference between revisions)
Jump to: navigation, search
(Initial version)
 
(userunitdir and /etc notes)
 
(One intermediate revision by one user not shown)
Line 9: Line 9:
 
  %{_unitdir}
 
  %{_unitdir}
  
User session units need:
+
In preparation for next version:
  %define _userunitdir %{_libdir}/systemd/user/
+
  %define _userunitdir /usr/lib/systemd/user/
  
Note that no units should ever be installed into /etc/
+
and install user units to:
 +
 
 +
%{_userunitdir}
 +
 
 +
Note that no units should ever be installed into /etc/ although the installation macros will create symlinks there.
  
 
Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.
 
Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.
Line 33: Line 37:
 
For services that don't support a restart (eg if clients have stateful connections) then use:
 
For services that don't support a restart (eg if clients have stateful connections) then use:
  
   %systemd_postun my.service
+
   %systemd_postun
 
+
  
 
These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed.
 
These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed.
Line 45: Line 48:
 
This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html
 
This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html
  
Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
+
Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd also http://www.freedesktop.org/software/systemd/man/daemon.html

Latest revision as of 13:25, 18 June 2013

Currently Mer packages require systemd in the build phase to use the systemd macros. This may change.

Until then your spec/yaml should contain:

BuildRequires:  systemd

System units should be installed to:

%{_unitdir}

In preparation for next version:

%define _userunitdir /usr/lib/systemd/user/

and install user units to:

%{_userunitdir}

Note that no units should ever be installed into /etc/ although the installation macros will create symlinks there.

Links should almost never be installed into systemd/system/*.wants ; instead use the [Install] section of the unit.


All the %preun %post and %postun macros must be provided.

The %preun macro is simply

%systemd_preun my.service

The %post macro

%systemd_post my.service

The %postun is typically

%systemd_postun_with_restart my.service

For services that don't support a restart (eg if clients have stateful connections) then use:

 %systemd_postun

These macros support the systemd 'preset' for controlling service policy. This essentially decides whether services run automatically when installed. Packages *must not* install preset files - the vendor should provide these.

[edit] References

The macros definitions can be found at http://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in

This thread was useful: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg10841.html

Fedora packaging snippets: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd also http://www.freedesktop.org/software/systemd/man/daemon.html

Personal tools