Archived
1
0
Fork 0

services: gpm: Use "make-forkexec-contstructor".

* gnu/services/base.scm (gpm-shepherd-service)[start]: Replace custom
logic with "make-forkexec-constructor".
This commit is contained in:
Brice Waegeneire 2021-07-03 20:07:07 +02:00
parent acfeccd8da
commit 1beeef6261
No known key found for this signature in database
GPG key ID: A94903A166A18FAE

View file

@ -2217,23 +2217,13 @@ instance."
(list (shepherd-service (list (shepherd-service
(requirement '(udev)) (requirement '(udev))
(provision '(gpm)) (provision '(gpm))
(start #~(lambda () ;; 'gpm' runs in the background and sets a PID file.
;; 'gpm' runs in the background and sets a PID file. ;; Note that it requires running as "root".
;; Note that it requires running as "root". (start #~(make-forkexec-constructor
(false-if-exception (delete-file "/var/run/gpm.pid")) (list #$(file-append gpm "/sbin/gpm")
(fork+exec-command (list #$(file-append gpm "/sbin/gpm") #$@options)
#$@options)) #:pid-file "/var/run/gpm.pid"
#:pid-file-timeout 3))
;; Wait for the PID file to appear; declare failure if
;; it doesn't show up.
(let loop ((i 3))
(or (file-exists? "/var/run/gpm.pid")
(if (zero? i)
#f
(begin
(sleep 1)
(loop (1- i))))))))
(stop #~(lambda (_) (stop #~(lambda (_)
;; Return #f if successfully stopped. ;; Return #f if successfully stopped.
(not (zero? (system* #$(file-append gpm "/sbin/gpm") (not (zero? (system* #$(file-append gpm "/sbin/gpm")