aboutsummaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-07-11 10:54:12 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-11 11:11:52 +0200
commit94a881178af9a9a918ce6de55641daa245c92e73 (patch)
tree75a2b0fad4f995c98aeac38d64fb6bdac910b0f8 /gnu/services
parent082725b5027a3782f242b634f94b9049d4c7f309 (diff)
downloadpatches-94a881178af9a9a918ce6de55641daa245c92e73.tar
patches-94a881178af9a9a918ce6de55641daa245c92e73.tar.gz
services: elogind: Start from the Shepherd.
Fixes <http://bugs.gnu.org/27580>. Reported by William <w@vieta.uk>. * gnu/services/desktop.scm (elogind-shepherd-service): New procedure. (elogind-service-type): Extend SHEPHERD-ROOT-SERVICE-TYPE.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/desktop.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 36049587d3..50a561bf51 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
@@ -653,6 +653,20 @@ seats.)"
(inherit pam)
(session (cons pam-elogind (pam-service-session pam)))))))
+(define (elogind-shepherd-service config)
+ "Return a Shepherd service to start elogind according to @var{config}."
+ (list (shepherd-service
+ (requirement '(dbus-system))
+ (provision '(elogind))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append (elogind-package config)
+ "/libexec/elogind/elogind"))
+ #:environment-variables
+ (list (string-append "ELOGIND_CONF_FILE="
+ #$(elogind-configuration-file
+ config)))))
+ (stop #~(make-kill-destructor)))))
+
(define elogind-service-type
(service-type (name 'elogind)
(extensions
@@ -663,6 +677,12 @@ seats.)"
(service-extension polkit-service-type
(compose list elogind-package))
+ ;; Start elogind from the Shepherd rather than waiting
+ ;; for bus activation. This ensures that it can handle
+ ;; events like lid close, etc.
+ (service-extension shepherd-root-service-type
+ elogind-shepherd-service)
+
;; Provide the 'loginctl' command.
(service-extension profile-service-type
(compose list elogind-package))