mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 05:39:41 -05:00
services: Add udev service, and add it to '%base-services'.
* gnu/services/base.scm (udev-service): New procedure. (%base-services): Use it. * gnu/system.scm (%base-packages): Add UDEV.
This commit is contained in:
parent
1bd3f84986
commit
151a2c07aa
2 changed files with 32 additions and 2 deletions
|
@ -23,6 +23,8 @@ (define-module (gnu services base)
|
|||
#:use-module (gnu system shadow) ; 'user-account', etc.
|
||||
#:use-module (gnu system linux) ; 'pam-service', etc.
|
||||
#:use-module (gnu packages admin)
|
||||
#:use-module ((gnu packages linux)
|
||||
#:select (udev))
|
||||
#:use-module ((gnu packages base)
|
||||
#:select (glibc-final))
|
||||
#:use-module (gnu packages package-management)
|
||||
|
@ -35,6 +37,7 @@ (define-module (gnu services base)
|
|||
file-system-service
|
||||
user-processes-service
|
||||
host-name-service
|
||||
udev-service
|
||||
mingetty-service
|
||||
nscd-service
|
||||
syslog-service
|
||||
|
@ -397,6 +400,32 @@ (define activate
|
|||
(id 30000))))
|
||||
(activate activate)))))
|
||||
|
||||
(define* (udev-service #:key (udev udev))
|
||||
"Run @var{udev}, which populates the @file{/dev} directory dynamically."
|
||||
(with-monad %store-monad
|
||||
(return (service
|
||||
(provision '(udev))
|
||||
(requirement '(root-file-system))
|
||||
(documentation "Populate the /dev directory.")
|
||||
(start #~(lambda ()
|
||||
(let ((pid (primitive-fork)))
|
||||
(case pid
|
||||
((0)
|
||||
;; In dmd 0.1, file descriptor 0 is closed, thus
|
||||
;; is gets reused when open(2) is called, and it
|
||||
;; turns out that EPOLL_CTL_ADD of 0 returns
|
||||
;; EPERM for some reason. So make sure 0 is
|
||||
;; open.
|
||||
;; FIXME: Close the other descriptors.
|
||||
(execl (string-append #$udev "/libexec/udev/udevd")
|
||||
"udevd"))
|
||||
(else
|
||||
;; Create a bunch of devices.
|
||||
(system* (string-append #$udev "/bin/udevadm")
|
||||
"trigger")
|
||||
pid)))))
|
||||
(stop #~(make-kill-destructor))))))
|
||||
|
||||
(define %base-services
|
||||
;; Convenience variable holding the basic services.
|
||||
(let ((motd (text-file "motd" "
|
||||
|
@ -409,6 +438,7 @@ (define %base-services
|
|||
(mingetty-service "tty6" #:motd motd)
|
||||
(syslog-service)
|
||||
(guix-service)
|
||||
(nscd-service))))
|
||||
(nscd-service)
|
||||
(udev-service))))
|
||||
|
||||
;;; base.scm ends here
|
||||
|
|
|
@ -218,7 +218,7 @@ (define %base-packages
|
|||
guile-final (@ (gnu packages admin) dmd) guix
|
||||
util-linux inetutils isc-dhcp
|
||||
net-tools ; XXX: remove when Inetutils suffices
|
||||
module-init-tools kbd
|
||||
module-init-tools udev kbd
|
||||
|
||||
;; The packages below are also in %FINAL-INPUTS, so take them from
|
||||
;; there to avoid duplication.
|
||||
|
|
Loading…
Reference in a new issue