services: elogind: Rely on D-Bus activation.
Previously elogind was explicitly spawned by the Shepherd. Now it is activated by dbus-daemon on demand. * gnu/packages/freedesktop.scm (elogind)[arguments]: Add 'fix-service-file' phase. * gnu/services/desktop.scm (elogind-shepherd-service): Remove. (elogind-dbus-service): New procedure. (elogind-service-type): Do not extend SHEPHERD-ROOT-SERVICE-TYPE. Use 'elogind-dbus-service' for DBUS-ROOT-SERVICE-TYPE.
This commit is contained in:
		
							parent
							
								
									ef8de9852e
								
							
						
					
					
						commit
						956ad60cad
					
				
					 2 changed files with 19 additions and 22 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 | 
					;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 | 
				
			||||||
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 | 
					;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 | 
				
			||||||
;;; Copyright © 2015 Andy Wingo <wingo@pobox.com>
 | 
					;;; Copyright © 2015 Andy Wingo <wingo@pobox.com>
 | 
				
			||||||
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
 | 
					;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 | 
				
			||||||
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 | 
					;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 | 
				
			||||||
;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
 | 
					;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
 | 
				
			||||||
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 | 
					;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 | 
				
			||||||
| 
						 | 
					@ -169,7 +169,17 @@ the freedesktop.org XDG Base Directory specification.")
 | 
				
			||||||
             ;; XXX: fail with:
 | 
					             ;; XXX: fail with:
 | 
				
			||||||
             ;;  src/shared/clean-ipc.c:315: undefined reference to `mq_unlink'
 | 
					             ;;  src/shared/clean-ipc.c:315: undefined reference to `mq_unlink'
 | 
				
			||||||
             "LDFLAGS=-lrt")
 | 
					             "LDFLAGS=-lrt")
 | 
				
			||||||
       #:make-flags '("PKTTYAGENT=/run/current-system/profile/bin/pkttyagent")))
 | 
					       #:make-flags '("PKTTYAGENT=/run/current-system/profile/bin/pkttyagent")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       #:phases (modify-phases %standard-phases
 | 
				
			||||||
 | 
					                  (add-before 'build 'fix-service-file
 | 
				
			||||||
 | 
					                    (lambda* (#:key outputs #:allow-other-keys)
 | 
				
			||||||
 | 
					                      ;; Fix the file name of the 'elogind' binary in the D-Bus
 | 
				
			||||||
 | 
					                      ;; '.service' file.
 | 
				
			||||||
 | 
					                      (substitute* "src/login/org.freedesktop.login1.service"
 | 
				
			||||||
 | 
					                        (("^Exec=.*")
 | 
				
			||||||
 | 
					                         (string-append "Exec=" (assoc-ref %outputs "out")
 | 
				
			||||||
 | 
					                                        "/libexec/elogind/elogind\n"))))))))
 | 
				
			||||||
    (native-inputs
 | 
					    (native-inputs
 | 
				
			||||||
     `(("intltool" ,intltool)
 | 
					     `(("intltool" ,intltool)
 | 
				
			||||||
       ("gettext" ,gnu-gettext)
 | 
					       ("gettext" ,gnu-gettext)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -647,22 +647,11 @@ include the @command{udisksctl} command, part of UDisks, and GNOME Disks."
 | 
				
			||||||
   ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
 | 
					   ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
 | 
				
			||||||
   ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))))
 | 
					   ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (elogind-shepherd-service config)
 | 
					(define (elogind-dbus-service config)
 | 
				
			||||||
  "Return a shepherd service for elogind, using @var{config}."
 | 
					  (list (wrapped-dbus-service (elogind-package config)
 | 
				
			||||||
  ;; TODO: We could probably rely on service activation but the '.service'
 | 
					                              "libexec/elogind/elogind"
 | 
				
			||||||
  ;; file currently contains an erroneous 'Exec' line.
 | 
					                              "ELOGIND_CONF_FILE"
 | 
				
			||||||
  (let ((config-file (elogind-configuration-file config))
 | 
					                              (elogind-configuration-file config))))
 | 
				
			||||||
        (elogind     (elogind-package config)))
 | 
					 | 
				
			||||||
    (list (shepherd-service
 | 
					 | 
				
			||||||
           (documentation "Run the elogind login and seat management service.")
 | 
					 | 
				
			||||||
           (provision '(elogind))
 | 
					 | 
				
			||||||
           (requirement '(dbus-system))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
           (start #~(make-forkexec-constructor
 | 
					 | 
				
			||||||
                     (list (string-append #$elogind "/libexec/elogind/elogind"))
 | 
					 | 
				
			||||||
                     #:environment-variables
 | 
					 | 
				
			||||||
                     (list (string-append "ELOGIND_CONF_FILE=" #$config-file))))
 | 
					 | 
				
			||||||
           (stop #~(make-kill-destructor))))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (pam-extension-procedure config)
 | 
					(define (pam-extension-procedure config)
 | 
				
			||||||
  "Return an extension for PAM-ROOT-SERVICE-TYPE that ensures that all the PAM
 | 
					  "Return an extension for PAM-ROOT-SERVICE-TYPE that ensures that all the PAM
 | 
				
			||||||
| 
						 | 
					@ -683,10 +672,8 @@ seats.)"
 | 
				
			||||||
(define elogind-service-type
 | 
					(define elogind-service-type
 | 
				
			||||||
  (service-type (name 'elogind)
 | 
					  (service-type (name 'elogind)
 | 
				
			||||||
                (extensions
 | 
					                (extensions
 | 
				
			||||||
                 (list (service-extension shepherd-root-service-type
 | 
					                 (list (service-extension dbus-root-service-type
 | 
				
			||||||
                                          elogind-shepherd-service)
 | 
					                                          elogind-dbus-service)
 | 
				
			||||||
                       (service-extension dbus-root-service-type
 | 
					 | 
				
			||||||
                                          (compose list elogind-package))
 | 
					 | 
				
			||||||
                       (service-extension udev-service-type
 | 
					                       (service-extension udev-service-type
 | 
				
			||||||
                                          (compose list elogind-package))
 | 
					                                          (compose list elogind-package))
 | 
				
			||||||
                       (service-extension polkit-service-type
 | 
					                       (service-extension polkit-service-type
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue