services: udev: Allow the use of eudev.

* gnu/services/base.scm (udev-service): Adjust 'start' method to support
  eudev in addition to udev.
This commit is contained in:
Ludovic Courtès 2014-09-13 10:53:47 +02:00
parent ba544e78dc
commit 66a99a0676
1 changed files with 11 additions and 1 deletions

View File

@ -527,8 +527,16 @@ extra rules from the packages listed in @var{rules}."
(documentation "Populate the /dev directory, dynamically.") (documentation "Populate the /dev directory, dynamically.")
(start #~(lambda () (start #~(lambda ()
(define find
(@ (srfi srfi-1) find))
(define udevd (define udevd
(string-append #$udev "/libexec/udev/udevd")) ;; Choose the right 'udevd'.
(find file-exists?
(map (lambda (suffix)
(string-append #$udev suffix))
'("/libexec/udev/udevd" ;udev
"/sbin/udevd")))) ;eudev
(define (wait-for-udevd) (define (wait-for-udevd)
;; Wait until someone's listening on udevd's control ;; Wait until someone's listening on udevd's control
@ -548,7 +556,9 @@ extra rules from the packages listed in @var{rules}."
(setenv "LINUX_MODULE_DIRECTORY" (setenv "LINUX_MODULE_DIRECTORY"
"/run/booted-system/kernel/lib/modules") "/run/booted-system/kernel/lib/modules")
;; The first one is for udev, the second one for eudev.
(setenv "UDEV_CONFIG_FILE" #$udev.conf) (setenv "UDEV_CONFIG_FILE" #$udev.conf)
(setenv "EUDEV_RULES_DIRECTORY" #$rules)
(let ((pid (primitive-fork))) (let ((pid (primitive-fork)))
(case pid (case pid