summary refs log tree commit diff
path: root/gnu/services/dbus.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-13 22:30:49 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-13 23:26:36 +0100
commit1f8ca28b9e517f73d1a640dbbd11eadbf35b885b (patch)
tree138b6643054ef2709010178bd1d31cd39cef172b /gnu/services/dbus.scm
parent7462a1de22636dde24d56225c67bb3c10118b698 (diff)
downloadguix-1f8ca28b9e517f73d1a640dbbd11eadbf35b885b.tar.gz
services: dbus: Simplify 'dbus-uuidgen' invocation.
* gnu/services/dbus.scm (dbus-activation): Use the "--ensure" option of
'dbus-uuidgen' instead of forking and redirecting ports.
Diffstat (limited to 'gnu/services/dbus.scm')
-rw-r--r--gnu/services/dbus.scm15
1 files changed, 3 insertions, 12 deletions
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index a97ce17c0c..7b3c8100e2 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -176,18 +176,9 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
 
       (unless (file-exists? "/etc/machine-id")
         (format #t "creating /etc/machine-id...~%")
-        (let ((prog (string-append #$(dbus-configuration-dbus config)
-                                   "/bin/dbus-uuidgen")))
-          ;; XXX: We can't use 'system' because the initrd's
-          ;; guile system(3) only works when 'sh' is in $PATH.
-          (let ((pid (primitive-fork)))
-            (if (zero? pid)
-                (call-with-output-file "/etc/machine-id"
-                  (lambda (port)
-                    (close-fdes 1)
-                    (dup2 (port->fdes port) 1)
-                    (execl prog)))
-                (waitpid pid)))))))
+        (invoke (string-append #$(dbus-configuration-dbus config)
+                               "/bin/dbus-uuidgen")
+                "--ensure=/etc/machine-id"))))
 
 (define dbus-shepherd-service
   (match-lambda