Archived
1
0
Fork 0

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.
This commit is contained in:
Maxim Cournoyer 2021-05-05 21:44:44 -04:00
parent a33afba4f1
commit b39c4e18f2
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -34,28 +34,29 @@
(spice-vdagent spice-vdagent-configuration-spice-vdagent (spice-vdagent spice-vdagent-configuration-spice-vdagent
(default spice-vdagent))) (default spice-vdagent)))
(define (spice-vdagent-activation config)
"Return the activation gexp for CONFIG."
#~(begin
(use-modules (guix build utils))
(mkdir-p "/run/spice-vdagentd")))
(define (spice-vdagent-shepherd-service config) (define (spice-vdagent-shepherd-service config)
"Return a <shepherd-service> for spice-vdagentd with CONFIG." "Return a <shepherd-service> for spice-vdagentd with CONFIG."
(define spice-vdagent (spice-vdagent-configuration-spice-vdagent config)) (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config))
(define spice-vdagentd-command (define spice-vdagentd-command
(list (list
(file-append spice-vdagent "/sbin/spice-vdagentd") (file-append spice-vdagent "/sbin/spice-vdagentd")
"-x")) "-x"))
(list (list
(shepherd-service (shepherd-service
(documentation "Spice vdagentd service") (documentation "Spice vdagentd service")
(requirement '(udev)) (requirement '(dbus-system))
(provision '(spice-vdagentd)) (provision '(spice-vdagentd))
(start #~(make-forkexec-constructor '#$spice-vdagentd-command)) (start #~(lambda args
(stop #~(make-kill-destructor))))) ;; spice-vdagentd supports being activated upon the client
;; connecting to its socket; when not using such feature, the
;; socket should not exist before vdagentd creates it itself.
(mkdir-p "/run/spice-vdagentd")
(false-if-exception
(delete-file "/run/spice-vdagentd/spice-vdagent-sock"))
(fork+exec-command '#$spice-vdagentd-command)))
(stop #~(make-kill-destructor)))))
(define spice-vdagent-profile (define spice-vdagent-profile
(compose list spice-vdagent-configuration-spice-vdagent)) (compose list spice-vdagent-configuration-spice-vdagent))
@ -67,8 +68,6 @@
(extensions (extensions
(list (service-extension shepherd-root-service-type (list (service-extension shepherd-root-service-type
spice-vdagent-shepherd-service) spice-vdagent-shepherd-service)
(service-extension activation-service-type
spice-vdagent-activation)
(service-extension profile-service-type (service-extension profile-service-type
spice-vdagent-profile))))) spice-vdagent-profile)))))