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.
This commit is contained in:
Ludovic Courtès 2019-11-13 22:30:49 +01:00
parent 7462a1de22
commit 1f8ca28b9e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -176,18 +176,9 @@ (define (dbus-activation config)
(unless (file-exists? "/etc/machine-id") (unless (file-exists? "/etc/machine-id")
(format #t "creating /etc/machine-id...~%") (format #t "creating /etc/machine-id...~%")
(let ((prog (string-append #$(dbus-configuration-dbus config) (invoke (string-append #$(dbus-configuration-dbus config)
"/bin/dbus-uuidgen"))) "/bin/dbus-uuidgen")
;; XXX: We can't use 'system' because the initrd's "--ensure=/etc/machine-id"))))
;; 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)))))))
(define dbus-shepherd-service (define dbus-shepherd-service
(match-lambda (match-lambda