summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-05-02 17:27:13 +0200
committerLudovic Courtès <ludo@gnu.org>2022-05-02 17:57:30 +0200
commit2a37f174becbafd70591f6eb1d98493c5c1df0e2 (patch)
tree028c0f836be69b4829828bdb248455371eb5d4ff
parent39d6c13fda7e9bad7116d450a28a1fcafaef03f8 (diff)
downloadguix-2a37f174becbafd70591f6eb1d98493c5c1df0e2.tar.gz
services: Make sure Shepherd destructors match constructors.
This is a followup to b06ecc57515d4e3c8b2228e8142654e9a26ba6e1,
211fe3f66e6dfdaa64974931c458ab1d92afc182, and
fd57ce267c4083fe98242caa31075d2bd62903bf.

* gnu/services/base.scm (guix-publish-shepherd-service): Change 'stop'
method to use 'make-systemd-destructor' when 'make-systemd-constructor'
is used.
* gnu/services/dict.scm (dicod-shepherd-service): Change 'stop' method
to use 'make-inetd-destructor' when 'make-inetd-constructor' is used.
* gnu/services/messaging.scm (bitlbee-shepherd-service): Likewise.
-rw-r--r--gnu/services/base.scm5
-rw-r--r--gnu/services/dict.scm5
-rw-r--r--gnu/services/messaging.scm4
3 files changed, 11 insertions, 3 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index e324864744..bcec888587 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1914,7 +1914,10 @@ raise a deprecation warning if the 'compression-level' field was used."
                           (make-systemd-constructor
                            #$command #$endpoints #$@options)
                           (make-forkexec-constructor #$command #$@options)))
-             (stop #~(make-kill-destructor)))))))
+             (stop #~(if (and (defined? 'make-systemd-destructor)
+                              #$(not advertise?))
+                         (make-systemd-destructor)
+                         (make-kill-destructor))))))))
 
 (define %guix-publish-accounts
   (list (user-group (name "guix-publish") (system? #t))
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 109917c05c..f042219cbd 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -179,7 +179,10 @@ database {
                          (list #$dicod "--foreground"
                                (string-append "--config=" #$dicod.conf))
                          #:user "dicod" #:group "dicod")))
-           (stop #~(make-kill-destructor))))))
+           (stop #~(if (and (defined? 'make-inetd-destructor)
+                            #$(= 1 (length interfaces))) ;XXX
+                       (make-inetd-destructor)
+                       (make-kill-destructor)))))))
 
 (define dicod-service-type
   (service-type
diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm
index f9e7e2aa09..26d47f47de 100644
--- a/gnu/services/messaging.scm
+++ b/gnu/services/messaging.scm
@@ -883,7 +883,9 @@ string, you could instantiate a prosody service like this:
                                                 (source "/var/lib/bitlbee")
                                                 (target source)
                                                 (writable? #t))))))
-                (stop  #~(make-kill-destructor)))))))))
+                (stop  #~(if (defined? 'make-inetd-destructor)
+                             (make-inetd-destructor)
+                             (make-kill-destructor))))))))))
 
 (define %bitlbee-accounts
   ;; User group and account to run BitlBee.