Archived
1
0
Fork 0

services: dbus: Add a VERBOSE? configuration option.

* gnu/services/dbus.scm (<dbus-configuration>)[verbose?]: New field.
(dbus-shepherd-service): Use it.
(dbus-service)[verbose?]: Add argument and update doc.
* doc/guix.texi (Desktop Services): Document it.
This commit is contained in:
Maxim Cournoyer 2021-12-07 22:48:39 -05:00
parent 3aaf52a129
commit a860a5fa95
No known key found for this signature in database
GPG key ID: 1260E46482E63562
2 changed files with 24 additions and 7 deletions

View file

@ -21767,9 +21767,14 @@ The actual service definitions included in @code{%desktop-services} and
provided by @code{(gnu services dbus)} and @code{(gnu services desktop)} provided by @code{(gnu services dbus)} and @code{(gnu services desktop)}
are described below. are described below.
@deffn {Scheme Procedure} dbus-service [#:dbus @var{dbus}] [#:services '()] @deffn {Scheme Procedure} dbus-service [#:dbus @var{dbus}] [#:services '()] @
[#:verbose?]
Return a service that runs the ``system bus'', using @var{dbus}, with Return a service that runs the ``system bus'', using @var{dbus}, with
support for @var{services}. support for @var{services}. When @var{verbose?} is true, it causes the
@samp{DBUS_VERBOSE} environment variable to be set to @samp{1}; a
verbose-enabled D-Bus package such as @code{dbus-verbose} should be
provided as @var{dbus} in this scenario. The verbose output is logged
to @file{/var/log/dbus-daemon.log}.
@uref{https://dbus.freedesktop.org/, D-Bus} is an inter-process communication @uref{https://dbus.freedesktop.org/, D-Bus} is an inter-process communication
facility. Its system bus is used to allow system services to communicate facility. Its system bus is used to allow system services to communicate

View file

@ -53,7 +53,9 @@
(dbus dbus-configuration-dbus ;file-like (dbus dbus-configuration-dbus ;file-like
(default dbus)) (default dbus))
(services dbus-configuration-services ;list of <package> (services dbus-configuration-services ;list of <package>
(default '()))) (default '()))
(verbose? dbus-configuration-verbose? ;boolean
(default #f)))
(define (system-service-directory services) (define (system-service-directory services)
"Return the system service directory, containing @code{.service} files for "Return the system service directory, containing @code{.service} files for
@ -191,7 +193,7 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
(define dbus-shepherd-service (define dbus-shepherd-service
(match-lambda (match-lambda
(($ <dbus-configuration> dbus) (($ <dbus-configuration> dbus _ verbose?)
(list (shepherd-service (list (shepherd-service
(documentation "Run the D-Bus system daemon.") (documentation "Run the D-Bus system daemon.")
(provision '(dbus-system)) (provision '(dbus-system))
@ -199,6 +201,12 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$dbus "/bin/dbus-daemon") (list (string-append #$dbus "/bin/dbus-daemon")
"--nofork" "--system" "--syslog-only") "--nofork" "--system" "--syslog-only")
#$@(if verbose?
;; Since the verbose output goes to the console,
;; not syslog, add a log file to capture it.
'(#:environment-variables '("DBUS_VERBOSE=1")
#:log-file "/var/log/dbus-daemon.log")
'())
#:pid-file "/var/run/dbus/pid")) #:pid-file "/var/run/dbus/pid"))
(stop #~(make-kill-destructor))))))) (stop #~(make-kill-destructor)))))))
@ -234,9 +242,12 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
bus. It allows programs and daemons to communicate and is also responsible bus. It allows programs and daemons to communicate and is also responsible
for spawning (@dfn{activating}) D-Bus services on demand."))) for spawning (@dfn{activating}) D-Bus services on demand.")))
(define* (dbus-service #:key (dbus dbus) (services '())) (define* (dbus-service #:key (dbus dbus) (services '()) verbose?)
"Return a service that runs the \"system bus\", using @var{dbus}, with "Return a service that runs the \"system bus\", using @var{dbus}, with
support for @var{services}. support for @var{services}. When @var{verbose?} is true, it causes the
@samp{DBUS_VERBOSE} environment variable to be set to @samp{1}; a
verbose-enabled D-Bus package such as @code{dbus-verbose} should be provided
as @var{dbus} in this scenario.
@uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication @uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication
facility. Its system bus is used to allow system services to communicate and facility. Its system bus is used to allow system services to communicate and
@ -248,7 +259,8 @@ and policy files. For example, to allow avahi-daemon to use the system bus,
@var{services} must be equal to @code{(list avahi)}." @var{services} must be equal to @code{(list avahi)}."
(service dbus-root-service-type (service dbus-root-service-type
(dbus-configuration (dbus dbus) (dbus-configuration (dbus dbus)
(services services)))) (services services)
(verbose? verbose?))))
(define (wrapped-dbus-service service program variables) (define (wrapped-dbus-service service program variables)
"Return a wrapper for @var{service}, a package containing a D-Bus service, "Return a wrapper for @var{service}, a package containing a D-Bus service,