summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-04-16 17:34:30 +0200
committerLudovic Courtès <ludo@gnu.org>2022-05-01 21:30:35 +0200
commitfd57ce267c4083fe98242caa31075d2bd62903bf (patch)
tree7a36b0a428bbd44c4b0b060e6b77a5cb4b4c3ac8 /gnu/services
parent002bcb7eb0513f56f321c37948653b8d7f0cadb0 (diff)
services: dicod: Use 'make-inetd-constructor'.
* gnu/services/dict.scm (dicod-shepherd-service): Use 'make-inetd-constructor' in the 'start' method when available.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/dict.scm18
1 files changed, 14 insertions, 4 deletions
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 62b21f8d53..109917c05c 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -146,6 +146,7 @@ database {
(define (dicod-shepherd-service config)
(let* ((dicod.conf (dicod-configuration-file config))
+ (interfaces (dicod-configuration-interfaces config))
(dicod (least-authority-wrapper
(file-append (dicod-configuration-dico config)
"/bin/dicod")
@@ -165,10 +166,19 @@ database {
(provision '(dicod))
(requirement '(user-processes))
(documentation "Run the dicod daemon.")
- (start #~(make-forkexec-constructor
- (list #$dicod "--foreground"
- (string-append "--config=" #$dicod.conf))
- #:user "dicod" #:group "dicod"))
+ (start #~(if (and (defined? 'make-inetd-constructor)
+ #$(= 1 (length interfaces))) ;XXX
+ (make-inetd-constructor
+ (list #$dicod "--inetd" "--foreground"
+ (string-append "--config=" #$dicod.conf))
+ (addrinfo:addr
+ (car (getaddrinfo #$(first interfaces) "dict")))
+ #:user "dicod" #:group "dicod"
+ #:service-name-stem "dicod")
+ (make-forkexec-constructor
+ (list #$dicod "--foreground"
+ (string-append "--config=" #$dicod.conf))
+ #:user "dicod" #:group "dicod")))
(stop #~(make-kill-destructor))))))
(define dicod-service-type