mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-12 06:06:53 -05:00
services: shepherd: Use the 0.10.x GOOPS-less interface.
* gnu/services/shepherd.scm (%default-modules): Remove (oop goops). (shepherd-service-file): Use (service …) instead of (make <service> …). Use ‘actions’ instead of ‘make-actions’. (scm->go): Remove use of (oop goops). (shepherd-configuration-file): Pass ‘register-services’ a list. Use ‘start-in-the-background’ unconditionally. Change-Id: I0ad1ba32e339c56ee31e59f160b53d3581277d97
This commit is contained in:
parent
b973480dc9
commit
477d4f7d24
1 changed files with 10 additions and 20 deletions
|
@ -183,7 +183,6 @@ (define %default-imported-modules
|
|||
(define %default-modules
|
||||
;; Default set of modules visible in a service's file.
|
||||
`((shepherd service)
|
||||
(oop goops)
|
||||
((guix build utils) #:hide (delete))
|
||||
(guix build syscalls)))
|
||||
|
||||
|
@ -300,10 +299,10 @@ (define (shepherd-service-file service)
|
|||
#~(begin
|
||||
(use-modules #$@(shepherd-service-modules service))
|
||||
|
||||
(make <service>
|
||||
#:docstring '#$(shepherd-service-documentation service)
|
||||
#:provides '#$(shepherd-service-provision service)
|
||||
#:requires '#$(shepherd-service-requirement service)
|
||||
(service
|
||||
'#$(shepherd-service-provision service)
|
||||
#:documentation '#$(shepherd-service-documentation service)
|
||||
#:requirement '#$(shepherd-service-requirement service)
|
||||
|
||||
;; The 'one-shot?' slot is new in Shepherd 0.6.0.
|
||||
;; Older versions ignore it.
|
||||
|
@ -313,7 +312,7 @@ (define (shepherd-service-file service)
|
|||
#:start #$(shepherd-service-start service)
|
||||
#:stop #$(shepherd-service-stop service)
|
||||
#:actions
|
||||
(make-actions
|
||||
(actions
|
||||
#$@(map (match-lambda
|
||||
(($ <shepherd-action> name proc doc)
|
||||
#~(#$name #$doc #$proc)))
|
||||
|
@ -338,7 +337,6 @@ (define shepherd&co
|
|||
|
||||
;; Do the same as the Shepherd's 'load-in-user-module'.
|
||||
(let ((env (make-fresh-user-module)))
|
||||
(module-use! env (resolve-interface '(oop goops)))
|
||||
(module-use! env (resolve-interface '(shepherd service)))
|
||||
(with-target #$(or target #~%host-type)
|
||||
(lambda _
|
||||
|
@ -401,25 +399,17 @@ (define config
|
|||
;; than a kernel panic.
|
||||
(call-with-error-handling
|
||||
(lambda ()
|
||||
(apply register-services
|
||||
(parameterize ((current-warning-port
|
||||
(%make-void-port "w")))
|
||||
(map load-compiled '#$(map scm->go files))))))
|
||||
(register-services
|
||||
(parameterize ((current-warning-port
|
||||
(%make-void-port "w")))
|
||||
(map load-compiled '#$(map scm->go files))))))
|
||||
|
||||
(format #t "starting services...~%")
|
||||
(let ((services-to-start
|
||||
'#$(append-map shepherd-service-provision
|
||||
(filter shepherd-service-auto-start?
|
||||
services))))
|
||||
(if (defined? 'start-in-the-background)
|
||||
(start-in-the-background services-to-start)
|
||||
(for-each (lambda (service) ;pre-0.9.0 compatibility
|
||||
(guard (c ((service-error? c)
|
||||
(format (current-error-port)
|
||||
"failed to start service '~a'~%"
|
||||
service)))
|
||||
(start service)))
|
||||
services-to-start))
|
||||
(start-in-the-background services-to-start)
|
||||
|
||||
;; Hang up stdin. At this point, we assume that 'start' methods
|
||||
;; that required user interaction on the console (e.g.,
|
||||
|
|
Loading…
Reference in a new issue