2368
Comment:
|
2142
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
= TODO = * for invoke-rc.d, we need to fix the reload/restart handling, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704923 * for update-rc.d in sysvinit, we also need to cover Also=, Alias= and RequiredBy= |
This draft describes how systemd packaging should be done in Debian. It will be integrated into ?Systemd once it has been reviewed.
systemd packaging
per-package
- Unit files should be installed to /lib/systemd/system/ under the same name (with .service suffix) as the init script. E.g. for a package shipping /etc/init.d/libvirt-bin, the corresponding service file should be /lib/systemd/system/libvirt-bin.service
- tmpfiles.d(5) configuration files should go to /usr/lib/tmpfiles.d/
The systemctl enable and systemctl start actions are performed through update-rc.d and invoke-rc.d (NOTE: These don’t provide the necessary code yet! See bug #683084 for a patch)
dh_installinit contains code to call systemd-tmpfiles --create when running under systemd and installs debian/<package>.service and debian/<package>.tmpfile to the proper locations (NOTE: You need debhelper from git for that)
globally
Calling systemctl enable on Debian will also run update-rc.d enable and vice-versa so that you can switch to and from systemd without losing this configuration.
- invoke-rc.d will automatically proxy its actions to systemd on systems running systemd
Custom actions are still passed to the initscript directly, for example the _cron action of /etc/init.d/atop. The actions which are passed to systemd are start, stop, restart, status, reload, force-stop and force-reload.
TODO: Do we want to recommend not using custom actions in initscripts?
To determine whether systemd is currently running on a system, use [ -d /run/systemd/system ]
unit files
Please don’t use After=syslog.target. It’s obsolete since syslog services are socket-activated nowadays.
debhelper changes
- in postrm we need systemctl --system daemon-reload
relevant links
http://bugs.debian.org/690399 (patch for debhelper to support systemd service files)
http://bugs.debian.org/683084 (update-rc.d/invoke-rc.d patch for systemd support, merged into the jessie-pending branch of sysvinit)