From 33f9778bc83086837b99e5c5e99cd514cb0d154e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 1 Nov 2019 23:29:06 +0100 Subject: services: dbus: Include each service's "share/dbus-1/system.d". Fixes . Reported by Jack Hill . Sometime between 1.1.8 and 1.4.3, 'colord' moved had its 'org.freedesktop.ColorManager.conf' file moved from "etc/dbus-1/system.d" to "share/dbus-1/system.d". Adjust to this change. * gnu/services/dbus.scm (dbus-configuration-directory): Add an 'includedir' directive for DIR/share/dbus-1/system.d. --- gnu/services/dbus.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gnu/services/dbus.scm') diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 35d7ff3c9c..fcdeb3bf60 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -100,6 +100,8 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in ,@(append-map (lambda (dir) `((includedir ,(string-append dir "/etc/dbus-1/system.d")) + (includedir + ,(string-append dir "/share/dbus-1/system.d")) (servicedir ;for '.service' files ,(string-append dir "/share/dbus-1/services")))) services))) -- cgit 1.4.1 From 27727b18b8597f7c6fd99adc7797c555aa1c92e9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 1 Nov 2019 23:48:40 +0100 Subject: services: dbus: Remove non-existent directories from 'system-local.conf'. This typically halves the number of entries in /etc/dbus-1/system-local.conf. * gnu/services/dbus.scm (dbus-configuration-directory)[build](directives): New macro. (services->sxml): Use it. --- gnu/services/dbus.scm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'gnu/services/dbus.scm') diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index fcdeb3bf60..a697a8820e 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -86,6 +86,19 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in (use-modules (sxml simple) (srfi srfi-1)) + (define-syntax directives + (syntax-rules () + ;; Expand the given directives (SXML expressions) only if their + ;; key names a file that exists. + ((_ (name directory) rest ...) + (let ((dir directory)) + (if (file-exists? dir) + `((name ,dir) + ,@(directives rest ...)) + (directives rest ...)))) + ((_) + '()))) + (define (services->sxml services) ;; Return the SXML 'includedir' clauses for DIRS. `(busconfig @@ -98,12 +111,13 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in (servicedir "/etc/dbus-1/system-services") ,@(append-map (lambda (dir) - `((includedir - ,(string-append dir "/etc/dbus-1/system.d")) - (includedir - ,(string-append dir "/share/dbus-1/system.d")) - (servicedir ;for '.service' files - ,(string-append dir "/share/dbus-1/services")))) + (directives + (includedir + (string-append dir "/etc/dbus-1/system.d")) + (includedir + (string-append dir "/share/dbus-1/system.d")) + (servicedir ;for '.service' files + (string-append dir "/share/dbus-1/services")))) services))) (mkdir #$output) -- cgit 1.4.1 From a01d2e300abf8721866c8d1f984b0db90d192f9d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Nov 2019 22:07:51 +0100 Subject: services: dbus: Add description. * gnu/services/dbus.scm (dbus-root-service-type)[description]: New field. --- gnu/services/dbus.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/services/dbus.scm') diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index a697a8820e..db634fe0d8 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -229,7 +229,10 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in (append (dbus-configuration-services config) services))))) - (default-value (dbus-configuration)))) + (default-value (dbus-configuration)) + (description "Run the system-wide D-Bus inter-process message +bus. It allows programs and daemons to communicate and is also responsible +for spawning (@dfn{activating}) D-Bus services on demand."))) (define* (dbus-service #:key (dbus dbus) (services '())) "Return a service that runs the \"system bus\", using @var{dbus}, with -- cgit 1.4.1 From 7462a1de22636dde24d56225c67bb3c10118b698 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Nov 2019 22:11:34 +0100 Subject: services: dbus: Log to syslog. * gnu/services/dbus.scm (dbus-shepherd-service): Add 'syslogd' to 'requirement'. Pass the "--syslog-only" command-line option. --- gnu/services/dbus.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services/dbus.scm') diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index db634fe0d8..a97ce17c0c 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -195,10 +195,10 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in (list (shepherd-service (documentation "Run the D-Bus system daemon.") (provision '(dbus-system)) - (requirement '(user-processes)) + (requirement '(user-processes syslogd)) (start #~(make-forkexec-constructor (list (string-append #$dbus "/bin/dbus-daemon") - "--nofork" "--system") + "--nofork" "--system" "--syslog-only") #:pid-file "/var/run/dbus/pid")) (stop #~(make-kill-destructor))))))) -- cgit 1.4.1 From 1f8ca28b9e517f73d1a640dbbd11eadbf35b885b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Nov 2019 22:30:49 +0100 Subject: services: dbus: Simplify 'dbus-uuidgen' invocation. * gnu/services/dbus.scm (dbus-activation): Use the "--ensure" option of 'dbus-uuidgen' instead of forking and redirecting ports. --- gnu/services/dbus.scm | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'gnu/services/dbus.scm') diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index a97ce17c0c..7b3c8100e2 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -176,18 +176,9 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in (unless (file-exists? "/etc/machine-id") (format #t "creating /etc/machine-id...~%") - (let ((prog (string-append #$(dbus-configuration-dbus config) - "/bin/dbus-uuidgen"))) - ;; XXX: We can't use 'system' because the initrd's - ;; guile system(3) only works when 'sh' is in $PATH. - (let ((pid (primitive-fork))) - (if (zero? pid) - (call-with-output-file "/etc/machine-id" - (lambda (port) - (close-fdes 1) - (dup2 (port->fdes port) 1) - (execl prog))) - (waitpid pid))))))) + (invoke (string-append #$(dbus-configuration-dbus config) + "/bin/dbus-uuidgen") + "--ensure=/etc/machine-id")))) (define dbus-shepherd-service (match-lambda -- cgit 1.4.1