1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 02:39:45 +01:00
Commit graph

8 commits

Author SHA1 Message Date
Erik Arvstedt
e2414c4a4f
systemd: improve systemd-activate.rb script
- Pass arguments verbatim to the `systemctl` subprocess, obviating the
  need for shell escaping.

- Use open3 for capturing subprocess output.

- Fix printing of commands during dry run.

- Simplify `X-RestartIfChanged` regular expression.

  1. Use \s to match whitespace, \b to match a word boundary.

  2. Rename variable to conform to Ruby's underscore naming
     conventions.

- Remove no-op set operation. Specifically, 'no_restart' and 'to_stop'
  are disjunct since

  1. After reloading the daemon with the new generation, units in
     'to_stop' (i.e. units from the old gen that are missing in the
     new gen) are not registered anymore in the systemd daemon.

  2. Hence, 'systemctl cat' returns no output for these units.

  3. Because this output is needed to detect 'no_restart' units,
     'no_restart' includes no units from 'to_stop'.

  So 'to_stop -= to_restart' is a no-op.

- Only notify about units that would otherwise be restarted. That is,
  exclude units that are started but not restarted.

- Previously, all inactive units, like short-running services, were
  handled as failed units.

  Now systemd activation doesn't fail for oneshot services like
  'setxkbmap' while 'servicesStartTimeoutMs' is set.

- Don't start unchanged oneshot services.

PR #1110
2020-03-24 00:00:44 +01:00
Robert Helgesson
28401ddd91
systemd: skip services taking an instance parameter
Fixes #730
2020-03-02 20:33:20 +01:00
Robert Helgesson
f0fe18cd22
systemd: start timers as well
Fixes #1019
2020-02-09 22:59:36 +01:00
Tobias Happ
4c9b40ca0e systemd-activate.rb: add start/stop/restart sockets 2019-08-07 23:12:30 +02:00
Robert Helgesson
6b42bd7abf
systemd: support X-RestartIfChanged = false
Having this in the unit file will prevent the file from being
restarted if a change is detected. This is useful if data loss may
occur if the unit is suddenly restarted. For example, restarting the
Emacs service may result in the loss of unsaved open buffers.
2019-04-18 01:38:20 +02:00
Robert Helgesson
0d246aa435
systemd: escape unit names in systemctl commands 2019-04-18 01:37:59 +02:00
Cornelius Mika
394045f68a systemd: improve comments 2018-05-09 16:22:02 +02:00
Cornelius Mika
8759a5a63e
systemd: add option to automatically start services 2017-12-11 18:25:49 +01:00