diff options
| author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-12-07 22:48:39 -0500 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-06-14 14:23:21 -0400 |
| commit | a860a5fa95a743093cbda5540fb5be7800439a9f (patch) | |
| tree | 757657410edc55e566139d10fbda2ff874e3e6dc /gnu/services | |
| parent | 3aaf52a129ccf1d42aefd31322d21f697ce026b4 (diff) | |
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.
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/dbus.scm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index ef6b82c5723..52cb1e3a516 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm | |||
| @@ -53,7 +53,9 @@ | |||
| 53 | (dbus dbus-configuration-dbus ;file-like | 53 | (dbus dbus-configuration-dbus ;file-like |
| 54 | (default dbus)) | 54 | (default dbus)) |
| 55 | (services dbus-configuration-services ;list of <package> | 55 | (services dbus-configuration-services ;list of <package> |
| 56 | (default '()))) | 56 | (default '())) |
| 57 | (verbose? dbus-configuration-verbose? ;boolean | ||
| 58 | (default #f))) | ||
| 57 | 59 | ||
| 58 | (define (system-service-directory services) | 60 | (define (system-service-directory services) |
| 59 | "Return the system service directory, containing @code{.service} files for | 61 | "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 | |||
| 191 | 193 | ||
| 192 | (define dbus-shepherd-service | 194 | (define dbus-shepherd-service |
| 193 | (match-lambda | 195 | (match-lambda |
| 194 | (($ <dbus-configuration> dbus) | 196 | (($ <dbus-configuration> dbus _ verbose?) |
| 195 | (list (shepherd-service | 197 | (list (shepherd-service |
| 196 | (documentation "Run the D-Bus system daemon.") | 198 | (documentation "Run the D-Bus system daemon.") |
| 197 | (provision '(dbus-system)) | 199 | (provision '(dbus-system)) |
| @@ -199,6 +201,12 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in | |||
| 199 | (start #~(make-forkexec-constructor | 201 | (start #~(make-forkexec-constructor |
| 200 | (list (string-append #$dbus "/bin/dbus-daemon") | 202 | (list (string-append #$dbus "/bin/dbus-daemon") |
| 201 | "--nofork" "--system" "--syslog-only") | 203 | "--nofork" "--system" "--syslog-only") |
| 204 | #$@(if verbose? | ||
| 205 | ;; Since the verbose output goes to the console, | ||
| 206 | ;; not syslog, add a log file to capture it. | ||
| 207 | '(#:environment-variables '("DBUS_VERBOSE=1") | ||
| 208 | #:log-file "/var/log/dbus-daemon.log") | ||
| 209 | '()) | ||
| 202 | #:pid-file "/var/run/dbus/pid")) | 210 | #:pid-file "/var/run/dbus/pid")) |
| 203 | (stop #~(make-kill-destructor))))))) | 211 | (stop #~(make-kill-destructor))))))) |
| 204 | 212 | ||
| @@ -234,9 +242,12 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in | |||
| 234 | bus. It allows programs and daemons to communicate and is also responsible | 242 | bus. It allows programs and daemons to communicate and is also responsible |
| 235 | for spawning (@dfn{activating}) D-Bus services on demand."))) | 243 | for spawning (@dfn{activating}) D-Bus services on demand."))) |
| 236 | 244 | ||
| 237 | (define* (dbus-service #:key (dbus dbus) (services '())) | 245 | (define* (dbus-service #:key (dbus dbus) (services '()) verbose?) |
| 238 | "Return a service that runs the \"system bus\", using @var{dbus}, with | 246 | "Return a service that runs the \"system bus\", using @var{dbus}, with |
| 239 | support for @var{services}. | 247 | support for @var{services}. When @var{verbose?} is true, it causes the |
| 248 | @samp{DBUS_VERBOSE} environment variable to be set to @samp{1}; a | ||
| 249 | verbose-enabled D-Bus package such as @code{dbus-verbose} should be provided | ||
| 250 | as @var{dbus} in this scenario. | ||
| 240 | 251 | ||
| 241 | @uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication | 252 | @uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication |
| 242 | facility. Its system bus is used to allow system services to communicate and | 253 | 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, | |||
| 248 | @var{services} must be equal to @code{(list avahi)}." | 259 | @var{services} must be equal to @code{(list avahi)}." |
| 249 | (service dbus-root-service-type | 260 | (service dbus-root-service-type |
| 250 | (dbus-configuration (dbus dbus) | 261 | (dbus-configuration (dbus dbus) |
| 251 | (services services)))) | 262 | (services services) |
| 263 | (verbose? verbose?)))) | ||
| 252 | 264 | ||
| 253 | (define (wrapped-dbus-service service program variables) | 265 | (define (wrapped-dbus-service service program variables) |
| 254 | "Return a wrapper for @var{service}, a package containing a D-Bus service, | 266 | "Return a wrapper for @var{service}, a package containing a D-Bus service, |
