diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-12-04 13:24:55 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-12-04 13:25:03 +0100 |
commit | 134f9fc6c99d08026e5310e20e003ff5aa0bcb50 (patch) | |
tree | 466dc7ceca675302e00c62d12f46a89b234a1d53 /guix | |
parent | e2469153d718e3a724c64e2e53a5e5745e80289b (diff) | |
download | deployment-134f9fc6c99d08026e5310e20e003ff5aa0bcb50.tar.gz deployment-134f9fc6c99d08026e5310e20e003ff5aa0bcb50.tar.bz2 deployment-134f9fc6c99d08026e5310e20e003ff5aa0bcb50.zip |
fix module import for shepherd service
Diffstat (limited to 'guix')
-rw-r--r-- | guix/config.scm | 25 | ||||
-rw-r--r-- | guix/shepherd-with-sock.scm | 11 |
2 files changed, 22 insertions, 14 deletions
diff --git a/guix/config.scm b/guix/config.scm index 481ab10..5e99709 100644 --- a/guix/config.scm +++ b/guix/config.scm @@ -27,7 +27,7 @@ (guix utils) (guix gexp) (guix records) - ((gnu packages admin) #:select (shadow)) + ((gnu packages admin) #:select (shadow shepherd)) (taler-helpers)) (use-system-modules nss) @@ -89,16 +89,19 @@ (provision '(fcgiwrap)) (documentation "Run the fcgiwrap daemon.") (requirement '(networking)) - (start (with-imported-modules - `(((shepherd-with-sock) => ,(local-file "shepherd-with-sock.scm"))) - #~(begin - (use-modules ((shepherd-with-sock) #:prefix my:)) - (my:make-forkexec-constructor - '(#$(file-append package "/sbin/fcgiwrap")) - #:user #$user - #:group #$group - #:stdin-socket #$parsed-socket)))) - (stop #~(make-kill-destructor)))))))) + (start (with-extensions + (list shepherd) + (with-imported-modules + `(((shepherd-with-sock) => ,(local-file "shepherd-with-sock.scm")) + ,@(source-module-closure '((shepherd service)))) + #~(begin + (use-modules ((shepherd-with-sock) #:prefix my:)) + (my:make-forkexec-constructor + '(#$(file-append package "/sbin/fcgiwrap")) + #:user #$user + #:group #$group + #:stdin-socket '#$parsed-socket))))) + (stop #~(make-kill-destructor)))))))) (define my-fcgiwrap-accounts diff --git a/guix/shepherd-with-sock.scm b/guix/shepherd-with-sock.scm index 2667b8c..cd4138d 100644 --- a/guix/shepherd-with-sock.scm +++ b/guix/shepherd-with-sock.scm @@ -1,4 +1,7 @@ (define-module (shepherd-with-sock) + #:use-module ((shepherd service) + #:select (handle-SIGCHLD + catch-system-error)) #:export (make-forkexec-constructor)) @@ -126,6 +129,10 @@ false." program (strerror (system-error-errno args))) (primitive-exit 1))))) +(define (ensure-sigchld-handler) + (unless (@@ (shepherd service) %sigchld-handler-installed?) + (sigaction SIGCHLD handle-SIGCHLD SA_NOCLDSTOP) + (set! (@@ (shepherd service) %sigchld-handler-installed?) #t))) (define* (fork+exec-command command #:key @@ -138,10 +145,8 @@ false." (stdin-socket #f)) "Spawn a process that executed COMMAND as per 'exec-command', and return its PID." + (ensure-sigchld-handler) ;; Install the SIGCHLD handler if this is the first fork+exec-command call - (unless %sigchld-handler-installed? - (sigaction SIGCHLD handle-SIGCHLD SA_NOCLDSTOP) - (set! %sigchld-handler-installed? #t)) (let ((pid (primitive-fork))) (if (zero? pid) (exec-command command |