services: avahi: Add #:debug? parameter.

* gnu/services/avahi.scm (<avahi-configuration>)[debug?]: New field.
(avahi-shepherd-service): Honor it.
(avahi-service): Add #:debug? and honor it.
* doc/guix.texi (Networking Services): Adjust accordingly.
This commit is contained in:
Ludovic Courtès 2016-06-27 21:35:46 +02:00
parent 194ccecf77
commit c8695f325d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 9 additions and 4 deletions

View file

@ -7767,7 +7767,7 @@ The @code{(gnu services avahi)} provides the following definition.
@deffn {Scheme Procedure} avahi-service [#:avahi @var{avahi}] @ @deffn {Scheme Procedure} avahi-service [#:avahi @var{avahi}] @
[#:host-name #f] [#:publish? #t] [#:ipv4? #t] @ [#:host-name #f] [#:publish? #t] [#:ipv4? #t] @
[#:ipv6? #t] [#:wide-area? #f] @ [#:ipv6? #t] [#:wide-area? #f] @
[#:domains-to-browse '()] [#:domains-to-browse '()] [#:debug? #f]
Return a service that runs @command{avahi-daemon}, a system-wide Return a service that runs @command{avahi-daemon}, a system-wide
mDNS/DNS-SD responder that allows for service discovery and mDNS/DNS-SD responder that allows for service discovery and
"zero-configuration" host name lookups (see @uref{http://avahi.org/}), and "zero-configuration" host name lookups (see @uref{http://avahi.org/}), and

View file

@ -42,6 +42,8 @@ (define-record-type* <avahi-configuration>
avahi-configuration? avahi-configuration?
(avahi avahi-configuration-avahi ;<package> (avahi avahi-configuration-avahi ;<package>
(default avahi)) (default avahi))
(debug? avahi-configuration-debug? ;Boolean
(default #f))
(host-name avahi-configuration-host-name) ;string (host-name avahi-configuration-host-name) ;string
(publish? avahi-configuration-publish?) ;Boolean (publish? avahi-configuration-publish?) ;Boolean
(ipv4? avahi-configuration-ipv4?) ;Boolean (ipv4? avahi-configuration-ipv4?) ;Boolean
@ -96,6 +98,7 @@ (define %avahi-activation
(define (avahi-shepherd-service config) (define (avahi-shepherd-service config)
"Return a list of <shepherd-service> for CONFIG." "Return a list of <shepherd-service> for CONFIG."
(let ((config (configuration-file config)) (let ((config (configuration-file config))
(debug? (avahi-configuration-debug? config))
(avahi (avahi-configuration-avahi config))) (avahi (avahi-configuration-avahi config)))
(list (shepherd-service (list (shepherd-service
(documentation "Run the Avahi mDNS/DNS-SD responder.") (documentation "Run the Avahi mDNS/DNS-SD responder.")
@ -104,7 +107,9 @@ (define (avahi-shepherd-service config)
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$avahi "/sbin/avahi-daemon") (list (string-append #$avahi "/sbin/avahi-daemon")
"--daemonize" "-f" #$config) "--daemonize"
#$@(if debug? #~("--debug") #~())
"-f" #$config)
#:pid-file "/var/run/avahi-daemon/pid")) #:pid-file "/var/run/avahi-daemon/pid"))
(stop #~(make-kill-destructor)))))) (stop #~(make-kill-destructor))))))
@ -128,7 +133,7 @@ (define avahi-service-type
(service-extension profile-service-type (service-extension profile-service-type
avahi-package)))))) avahi-package))))))
(define* (avahi-service #:key (avahi avahi) (define* (avahi-service #:key (avahi avahi) debug?
host-name host-name
(publish? #t) (publish? #t)
(ipv4? #t) (ipv6? #t) (ipv4? #t) (ipv6? #t)
@ -156,7 +161,7 @@ (define* (avahi-service #:key (avahi avahi)
sockets." sockets."
(service avahi-service-type (service avahi-service-type
(avahi-configuration (avahi-configuration
(avahi avahi) (host-name host-name) (avahi avahi) (debug? debug?) (host-name host-name)
(publish? publish?) (ipv4? ipv4?) (ipv6? ipv6?) (publish? publish?) (ipv4? ipv4?) (ipv6? ipv6?)
(wide-area? wide-area?) (wide-area? wide-area?)
(domains-to-browse domains-to-browse)))) (domains-to-browse domains-to-browse))))