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:
Brice Waegeneire 2020-07-04 20:54:29 +02:00 committed by Danny Milosavljevic
parent ff1a9f0d17
commit 3d3185b544
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5

View File

@ -147,35 +147,34 @@ representation."
(define kernel-module-loader-shepherd-service (define kernel-module-loader-shepherd-service
(match-lambda (match-lambda
((and (? list? kernel-modules) ((? string?) ...)) ((and (? list? kernel-modules) ((? string?) ...))
(list (shepherd-service
(shepherd-service (documentation "Load kernel modules.")
(documentation "Load kernel modules.") (provision '(kernel-module-loader))
(provision '(kernel-module-loader)) (requirement '(file-systems))
(requirement '(file-systems)) (one-shot? #t)
(one-shot? #t) (modules `((srfi srfi-1)
(modules `((srfi srfi-1) (srfi srfi-34)
(srfi srfi-34) (srfi srfi-35)
(srfi srfi-35) (rnrs io ports)
(rnrs io ports) ,@%default-modules))
,@%default-modules)) (start
(start #~(lambda _
#~(lambda _ (cond
(cond ((null? '#$kernel-modules) #t)
((null? '#$kernel-modules) #t) ((file-exists? "/proc/sys/kernel/modprobe")
((file-exists? "/proc/sys/kernel/modprobe") (let ((modprobe (call-with-input-file
(let ((modprobe (call-with-input-file "/proc/sys/kernel/modprobe" get-line)))
"/proc/sys/kernel/modprobe" get-line))) (guard (c ((message-condition? c)
(guard (c ((message-condition? c) (format (current-error-port) "~a~%"
(format (current-error-port) "~a~%" (condition-message c))
(condition-message c)) #f))
#f)) (every (lambda (module)
(every (lambda (module) (invoke/quiet modprobe "--" module))
(invoke/quiet modprobe "--" module)) '#$kernel-modules))))
'#$kernel-modules)))) (else
(else (format (current-error-port) "error: ~a~%"
(format (current-error-port) "error: ~a~%" "Kernel is missing loadable module support.")
"Kernel is missing loadable module support.") #f))))))))
#f)))))))))
(define kernel-module-loader-service-type (define kernel-module-loader-service-type
(service-type (service-type
@ -183,7 +182,7 @@ representation."
(description "Load kernel modules.") (description "Load kernel modules.")
(extensions (extensions
(list (service-extension shepherd-root-service-type (list (service-extension shepherd-root-service-type
kernel-module-loader-shepherd-service))) (compose list kernel-module-loader-shepherd-service))))
(compose concatenate) (compose concatenate)
(extend append) (extend append)
(default-value '()))) (default-value '())))