summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-01-03 16:54:06 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-01-03 16:54:06 +0100
commit0add6760a62dbd67501b6a50feaf42d2edb8ca30 (patch)
tree244e01539b92d57a934bdb833910a547d3fe6c94 /guix
parent017742739e592ccc82e9239b40306c89854b3bf9 (diff)
downloaddeployment-0add6760a62dbd67501b6a50feaf42d2edb8ca30.tar.gz
deployment-0add6760a62dbd67501b6a50feaf42d2edb8ca30.tar.bz2
deployment-0add6760a62dbd67501b6a50feaf42d2edb8ca30.zip
fix permission adjustment
Diffstat (limited to 'guix')
-rw-r--r--guix/fixed-fcgiwrap.scm29
1 files changed, 19 insertions, 10 deletions
diff --git a/guix/fixed-fcgiwrap.scm b/guix/fixed-fcgiwrap.scm
index c5f84b0..21b39d6 100644
--- a/guix/fixed-fcgiwrap.scm
+++ b/guix/fixed-fcgiwrap.scm
@@ -7,6 +7,7 @@
#:use-module (gnu packages web)
#:use-module (gnu services shepherd)
#:use-module (guix modules)
+ #:use-module (guix i18n)
#:use-module (guix records)
#:use-module (guix gexp)
#:export (fcgiwrap-configuration
@@ -89,7 +90,7 @@
(provision '(fcgiwrap))
(documentation "Run the fcgiwrap daemon.")
(requirement '(networking))
- (modules `((ice-9 match) ,@%default-modules))
+ (modules `((shepherd support) (ice-9 match) ,@%default-modules))
(start
#~(lambda args
(define (clean-up file)
@@ -99,15 +100,21 @@
(lambda args
(unless (= ENOENT (system-error-errno args))
(apply throw args)))))
- (define* (wait-for-file file #:key (max-delay 5))
+ (define* (wait-for-file file #:key (max-delay 10))
(define start (current-time))
+ (local-output "w: waiting for file ~s" file)
(let loop ()
(cond
- ((file-exists? file) #t)
+ ((file-exists? file)
+ (local-output "w: file ~s exists" file)
+ #t)
((< (current-time) (+ start max-delay))
+ (local-output "w: file ~s does not exist yet" file)
(sleep 1)
(loop))
- (else #f))))
+ (else
+ (local-output "w: file ~s: giving up" file)
+ #f))))
(define (adjust-permissions file mode)
(match mode
(#t (chmod file #o660))
@@ -132,12 +139,14 @@
(clean-up path)
(when #$ensure-dir?
(ensure-socket-dir (dirname path) #$user #$group))
- (let ((pid (start-fcgiwrap)))
- (cond
- ((wait-for-file path)
- (adjust-permissions path perm)
- pid)
- (else #f))))
+ (let ((pid (start-fcgiwrap))
+ (socket-exists? (wait-for-file path)))
+ (if socket-exists?
+ (adjust-permissions path #$perm)
+ (local-output
+ #$(G_ "fcgiwrap: warning: waiting for socket ~s failed")
+ path))
+ pid))
(_ (start-fcgiwrap)))))
(stop #~(make-kill-destructor)))))))