mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-23 11:09:41 -05:00
gnu: dmd: Update start/stop of standard service definitions.
* gnu/system/dmd.scm (mingetty-service): Add 'stop' field. (nscd-service): Run with '--foreground'. Change 'stop' to use 'make-kill-destructor'. (syslog-service): Run with '--no-detach'; change 'stop' similarly. (guix-service): Likewise for 'stop'. (static-networking-service): Remove 'sleep' call from 'start'. Change 'stop' to return #f when networking was actually stopped.
This commit is contained in:
parent
2941448ea8
commit
f5a345adeb
1 changed files with 13 additions and 15 deletions
|
@ -95,6 +95,7 @@ (define (mingetty-service tty)
|
||||||
(requirement '(host-name))
|
(requirement '(host-name))
|
||||||
|
|
||||||
(start `(make-forkexec-constructor ,mingetty-bin "--noclear" ,tty))
|
(start `(make-forkexec-constructor ,mingetty-bin "--noclear" ,tty))
|
||||||
|
(stop `(make-kill-destructor))
|
||||||
(inputs `(("mingetty" ,mingetty)))))))
|
(inputs `(("mingetty" ,mingetty)))))))
|
||||||
|
|
||||||
(define* (nscd-service #:key (glibc glibc-final))
|
(define* (nscd-service #:key (glibc glibc-final))
|
||||||
|
@ -103,14 +104,9 @@ (define* (nscd-service #:key (glibc glibc-final))
|
||||||
(return (service
|
(return (service
|
||||||
(documentation "Run libc's name service cache daemon (nscd).")
|
(documentation "Run libc's name service cache daemon (nscd).")
|
||||||
(provision '(nscd))
|
(provision '(nscd))
|
||||||
(start `(make-forkexec-constructor ,nscd "-f" "/dev/null"))
|
(start `(make-forkexec-constructor ,nscd "-f" "/dev/null"
|
||||||
|
"--foreground"))
|
||||||
;; XXX: Local copy of 'make-kill-destructor' because the one upstream
|
(stop `(make-kill-destructor))
|
||||||
;; uses the broken 'opt-lambda' macro.
|
|
||||||
(stop `(lambda* (#:optional (signal SIGTERM))
|
|
||||||
(lambda (pid . args)
|
|
||||||
(kill pid signal)
|
|
||||||
#f)))
|
|
||||||
|
|
||||||
(respawn? #f)
|
(respawn? #f)
|
||||||
(inputs `(("glibc" ,glibc)))))))
|
(inputs `(("glibc" ,glibc)))))))
|
||||||
|
@ -147,8 +143,9 @@ (define contents "
|
||||||
(service
|
(service
|
||||||
(documentation "Run the syslog daemon (syslogd).")
|
(documentation "Run the syslog daemon (syslogd).")
|
||||||
(provision '(syslogd))
|
(provision '(syslogd))
|
||||||
(start `(make-forkexec-constructor ,syslogd
|
(start `(make-forkexec-constructor ,syslogd "--no-detach"
|
||||||
"--rcfile" ,syslog.conf))
|
"--rcfile" ,syslog.conf))
|
||||||
|
(stop `(make-kill-destructor))
|
||||||
(inputs `(("inetutils" ,inetutils)
|
(inputs `(("inetutils" ,inetutils)
|
||||||
("syslog.conf" ,syslog.conf)))))))
|
("syslog.conf" ,syslog.conf)))))))
|
||||||
|
|
||||||
|
@ -160,6 +157,7 @@ (define* (guix-service #:key (guix guix) (builder-group "guixbuild"))
|
||||||
(start `(make-forkexec-constructor ,daemon
|
(start `(make-forkexec-constructor ,daemon
|
||||||
"--build-users-group"
|
"--build-users-group"
|
||||||
,builder-group))
|
,builder-group))
|
||||||
|
(stop `(make-kill-destructor))
|
||||||
(inputs `(("guix" ,guix)))))))
|
(inputs `(("guix" ,guix)))))))
|
||||||
|
|
||||||
(define* (static-networking-service interface ip
|
(define* (static-networking-service interface ip
|
||||||
|
@ -182,16 +180,16 @@ (define* (static-networking-service interface ip
|
||||||
"' interface using a static IP address."))
|
"' interface using a static IP address."))
|
||||||
(provision '(networking))
|
(provision '(networking))
|
||||||
(start `(lambda _
|
(start `(lambda _
|
||||||
|
;; Return #t if successfully started.
|
||||||
(and (zero? (system* ,ifconfig ,interface ,ip "up"))
|
(and (zero? (system* ,ifconfig ,interface ,ip "up"))
|
||||||
,(if gateway
|
,(if gateway
|
||||||
`(begin
|
`(zero? (system* ,route "add" "-net" "default"
|
||||||
(sleep 3) ; XXX
|
"gw" ,gateway))
|
||||||
(zero? (system* ,route "add" "-net" "default"
|
|
||||||
"gw" ,gateway)))
|
|
||||||
#t))))
|
#t))))
|
||||||
(stop `(lambda _
|
(stop `(lambda _
|
||||||
(system* ,ifconfig ,interface "down")
|
;; Return #f is successfully stopped.
|
||||||
(system* ,route "del" "-net" "default")))
|
(not (and (system* ,ifconfig ,interface "down")
|
||||||
|
(system* ,route "del" "-net" "default")))))
|
||||||
(respawn? #f)
|
(respawn? #f)
|
||||||
(inputs `(("inetutils" ,inetutils)
|
(inputs `(("inetutils" ,inetutils)
|
||||||
,@(if gateway
|
,@(if gateway
|
||||||
|
|
Loading…
Reference in a new issue