From 17881f944e84b560dcc1537257e454f8de306001 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 18 Aug 2020 23:08:26 +0530 Subject: [PATCH] services: fcgiwrap: Create parent directory for unix socket. * gnu/services/web.scm (fcgiwrap-activation): New function. (fcgiwrap-service-type): Extend activation-service-type with fcgiwrap-activation. --- gnu/services/web.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 3b9f9e40be..d11a1c0545 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -12,6 +12,7 @@ ;;; Copyright © 2019, 2020 Florian Pelz ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2020 Tobias Geerinckx-Rice +;;; Copyright © 2020 Arun Isaac ;;; ;;; This file is part of GNU Guix. ;;; @@ -794,13 +795,29 @@ (define fcgiwrap-shepherd-service #:user #$user #:group #$group)) (stop #~(make-kill-destructor))))))) +(define fcgiwrap-activation + (match-lambda + (($ package socket user group) + #~(begin + ;; When listening on a unix socket, create a parent directory for the + ;; socket with the correct permissions. + (when (string-prefix? "unix:" #$socket) + (let ((run-directory + (dirname (substring #$socket (string-length "unix:"))))) + (mkdir-p run-directory) + (chown run-directory + (passwd:uid (getpw #$user)) + (group:gid (getgr #$group))))))))) + (define fcgiwrap-service-type (service-type (name 'fcgiwrap) (extensions (list (service-extension shepherd-root-service-type fcgiwrap-shepherd-service) (service-extension account-service-type - fcgiwrap-accounts))) + fcgiwrap-accounts) + (service-extension activation-service-type + fcgiwrap-activation))) (default-value (fcgiwrap-configuration)))) (define-record-type* php-fpm-configuration