summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-05-05 21:44:44 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-05-06 16:51:49 -0400
commitb39c4e18f28d39929a034a2350b316038044638e (patch)
treef4cd794a123e6884c1d3e787d28fc7f25cf70d5d /gnu
parenta33afba4f1fa6350fe6e1100c6277ca92aca8a40 (diff)
services: spice-vdagent: Clear the socket file prior to starting.
This fixes the following issue where spice-vdagent would fail to start if the spice-vdagent-sock socket file already existed: spice-vdagentd: Fatal could not create the server socket /run/spice-vdagentd/spice-vdagent-sock: Error binding to address: Address already in use The requirement is also modified to depend on dbus-system, a cue taken from upstream's own systemd service file (see 'data/spice-vdagentd.service' in the sources). * gnu/services/spice.scm (spice-vdagent-activation): Delete procedure. (spice-vdagent-shepherd-service): Fix indentation. [requirement]: Replace udev by dbus-system. [start]: Ensure the spice-vdagentd run-time directory exists and that the spice-vdagent-sock socket file does *not* exist before forking the daemon.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/spice.scm31
1 files changed, 15 insertions, 16 deletions
diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm
index a2aee4ab2a6..3b88e290431 100644
--- a/gnu/services/spice.scm
+++ b/gnu/services/spice.scm
@@ -34,28 +34,29 @@
34 (spice-vdagent spice-vdagent-configuration-spice-vdagent 34 (spice-vdagent spice-vdagent-configuration-spice-vdagent
35 (default spice-vdagent))) 35 (default spice-vdagent)))
36 36
37(define (spice-vdagent-activation config)
38 "Return the activation gexp for CONFIG."
39 #~(begin
40 (use-modules (guix build utils))
41 (mkdir-p "/run/spice-vdagentd")))
42
43(define (spice-vdagent-shepherd-service config) 37(define (spice-vdagent-shepherd-service config)
44 "Return a <shepherd-service> for spice-vdagentd with CONFIG." 38 "Return a <shepherd-service> for spice-vdagentd with CONFIG."
45 (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config)) 39 (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config))
46 40
47 (define spice-vdagentd-command 41 (define spice-vdagentd-command
48 (list 42 (list
49 (file-append spice-vdagent "/sbin/spice-vdagentd") 43 (file-append spice-vdagent "/sbin/spice-vdagentd")
50 "-x")) 44 "-x"))
51 45
52 (list 46 (list
53 (shepherd-service 47 (shepherd-service
54 (documentation "Spice vdagentd service") 48 (documentation "Spice vdagentd service")
55 (requirement '(udev)) 49 (requirement '(dbus-system))
56 (provision '(spice-vdagentd)) 50 (provision '(spice-vdagentd))
57 (start #~(make-forkexec-constructor '#$spice-vdagentd-command)) 51 (start #~(lambda args
58 (stop #~(make-kill-destructor))))) 52 ;; spice-vdagentd supports being activated upon the client
53 ;; connecting to its socket; when not using such feature, the
54 ;; socket should not exist before vdagentd creates it itself.
55 (mkdir-p "/run/spice-vdagentd")
56 (false-if-exception
57 (delete-file "/run/spice-vdagentd/spice-vdagent-sock"))
58 (fork+exec-command '#$spice-vdagentd-command)))
59 (stop #~(make-kill-destructor)))))
59 60
60(define spice-vdagent-profile 61(define spice-vdagent-profile
61 (compose list spice-vdagent-configuration-spice-vdagent)) 62 (compose list spice-vdagent-configuration-spice-vdagent))
@@ -67,8 +68,6 @@
67 (extensions 68 (extensions
68 (list (service-extension shepherd-root-service-type 69 (list (service-extension shepherd-root-service-type
69 spice-vdagent-shepherd-service) 70 spice-vdagent-shepherd-service)
70 (service-extension activation-service-type
71 spice-vdagent-activation)
72 (service-extension profile-service-type 71 (service-extension profile-service-type
73 spice-vdagent-profile))))) 72 spice-vdagent-profile)))))
74 73