mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
services: kernel-module-loader: Return a single 'shepherd-service'.
* gnu/services/linux.scm (kernel-module-loader-shepherd-service): Return a 'shepherd-service' instead of a list of it. (kernel-module-loader-service-type): Adjust it. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
This commit is contained in:
parent
ff1a9f0d17
commit
3d3185b544
1 changed files with 29 additions and 30 deletions
|
@ -147,35 +147,34 @@ (define earlyoom-service-type
|
|||
(define kernel-module-loader-shepherd-service
|
||||
(match-lambda
|
||||
((and (? list? kernel-modules) ((? string?) ...))
|
||||
(list
|
||||
(shepherd-service
|
||||
(documentation "Load kernel modules.")
|
||||
(provision '(kernel-module-loader))
|
||||
(requirement '(file-systems))
|
||||
(one-shot? #t)
|
||||
(modules `((srfi srfi-1)
|
||||
(srfi srfi-34)
|
||||
(srfi srfi-35)
|
||||
(rnrs io ports)
|
||||
,@%default-modules))
|
||||
(start
|
||||
#~(lambda _
|
||||
(cond
|
||||
((null? '#$kernel-modules) #t)
|
||||
((file-exists? "/proc/sys/kernel/modprobe")
|
||||
(let ((modprobe (call-with-input-file
|
||||
"/proc/sys/kernel/modprobe" get-line)))
|
||||
(guard (c ((message-condition? c)
|
||||
(format (current-error-port) "~a~%"
|
||||
(condition-message c))
|
||||
#f))
|
||||
(every (lambda (module)
|
||||
(invoke/quiet modprobe "--" module))
|
||||
'#$kernel-modules))))
|
||||
(else
|
||||
(format (current-error-port) "error: ~a~%"
|
||||
"Kernel is missing loadable module support.")
|
||||
#f)))))))))
|
||||
(shepherd-service
|
||||
(documentation "Load kernel modules.")
|
||||
(provision '(kernel-module-loader))
|
||||
(requirement '(file-systems))
|
||||
(one-shot? #t)
|
||||
(modules `((srfi srfi-1)
|
||||
(srfi srfi-34)
|
||||
(srfi srfi-35)
|
||||
(rnrs io ports)
|
||||
,@%default-modules))
|
||||
(start
|
||||
#~(lambda _
|
||||
(cond
|
||||
((null? '#$kernel-modules) #t)
|
||||
((file-exists? "/proc/sys/kernel/modprobe")
|
||||
(let ((modprobe (call-with-input-file
|
||||
"/proc/sys/kernel/modprobe" get-line)))
|
||||
(guard (c ((message-condition? c)
|
||||
(format (current-error-port) "~a~%"
|
||||
(condition-message c))
|
||||
#f))
|
||||
(every (lambda (module)
|
||||
(invoke/quiet modprobe "--" module))
|
||||
'#$kernel-modules))))
|
||||
(else
|
||||
(format (current-error-port) "error: ~a~%"
|
||||
"Kernel is missing loadable module support.")
|
||||
#f))))))))
|
||||
|
||||
(define kernel-module-loader-service-type
|
||||
(service-type
|
||||
|
@ -183,7 +182,7 @@ (define kernel-module-loader-service-type
|
|||
(description "Load kernel modules.")
|
||||
(extensions
|
||||
(list (service-extension shepherd-root-service-type
|
||||
kernel-module-loader-shepherd-service)))
|
||||
(compose list kernel-module-loader-shepherd-service))))
|
||||
(compose concatenate)
|
||||
(extend append)
|
||||
(default-value '())))
|
||||
|
|
Loading…
Reference in a new issue