From 6b0704339dacaada2dd9a999395c2dffc1bd9af0 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sat, 17 Apr 2021 00:29:06 -0400 Subject: services: Fix the spice-vdagent service. * gnu/services/spice.scm (spice-vdagent-activation): Update runtime directory from /var/run/spice-vdagentd to /run/spice-vdagentd. (spice-vdagent-service-type): Specify a default value and fix indentation. --- gnu/services/spice.scm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm index fd85dc234f..a2aee4ab2a 100644 --- a/gnu/services/spice.scm +++ b/gnu/services/spice.scm @@ -38,7 +38,7 @@ "Return the activation gexp for CONFIG." #~(begin (use-modules (guix build utils)) - (mkdir-p "/var/run/spice-vdagentd"))) + (mkdir-p "/run/spice-vdagentd"))) (define (spice-vdagent-shepherd-service config) "Return a for spice-vdagentd with CONFIG." @@ -61,14 +61,16 @@ (compose list spice-vdagent-configuration-spice-vdagent)) (define spice-vdagent-service-type - (service-type (name 'spice-vdagent) - (extensions - (list (service-extension shepherd-root-service-type - spice-vdagent-shepherd-service) - (service-extension activation-service-type - spice-vdagent-activation) - (service-extension profile-service-type - spice-vdagent-profile))))) + (service-type + (name 'spice-vdagent) + (default-value (spice-vdagent-configuration)) + (extensions + (list (service-extension shepherd-root-service-type + spice-vdagent-shepherd-service) + (service-extension activation-service-type + spice-vdagent-activation) + (service-extension profile-service-type + spice-vdagent-profile))))) (define* (spice-vdagent-service #:optional (config (spice-vdagent-configuration))) -- cgit 1.4.1 From b39c4e18f28d39929a034a2350b316038044638e Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 5 May 2021 21:44:44 -0400 Subject: 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. --- gnu/services/spice.scm | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm index a2aee4ab2a..3b88e29043 100644 --- a/gnu/services/spice.scm +++ b/gnu/services/spice.scm @@ -34,28 +34,29 @@ (spice-vdagent spice-vdagent-configuration-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) "Return a for spice-vdagentd with CONFIG." (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config)) (define spice-vdagentd-command (list - (file-append spice-vdagent "/sbin/spice-vdagentd") - "-x")) + (file-append spice-vdagent "/sbin/spice-vdagentd") + "-x")) (list - (shepherd-service - (documentation "Spice vdagentd service") - (requirement '(udev)) - (provision '(spice-vdagentd)) - (start #~(make-forkexec-constructor '#$spice-vdagentd-command)) - (stop #~(make-kill-destructor))))) + (shepherd-service + (documentation "Spice vdagentd service") + (requirement '(dbus-system)) + (provision '(spice-vdagentd)) + (start #~(lambda args + ;; 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 (compose list spice-vdagent-configuration-spice-vdagent)) @@ -67,8 +68,6 @@ (extensions (list (service-extension shepherd-root-service-type spice-vdagent-shepherd-service) - (service-extension activation-service-type - spice-vdagent-activation) (service-extension profile-service-type spice-vdagent-profile))))) -- cgit 1.4.1