summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-28 16:06:19 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-01-28 16:22:56 +0100
commit5ba7e828ad27d5c3d84e85d4277bbfeccca33270 (patch)
tree0fb23f7b37c8745d32887f8e99e623176b48149d
parent8d8bbe7c637dd9f280cb7770fec50eacb4a88116 (diff)
downloadguix-5ba7e828ad27d5c3d84e85d4277bbfeccca33270.tar.gz
services: cuirass: Create remote-server cache directory.
* gnu/services/cuirass.scm (cuirass-activation): Create remote-server cache
directory if needed.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--gnu/services/cuirass.scm23
1 files changed, 17 insertions, 6 deletions
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index ea6f771849..2d0bf47b48 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -243,11 +243,16 @@
 
 (define (cuirass-activation config)
   "Return the activation code for CONFIG."
-  (let ((cache (cuirass-configuration-cache-directory config))
-        (db    (dirname (cuirass-configuration-database config)))
-        (user  (cuirass-configuration-user config))
-        (log   "/var/log/cuirass")
-        (group (cuirass-configuration-group config)))
+  (let* ((cache          (cuirass-configuration-cache-directory config))
+         (remote-server  (cuirass-configuration-remote-server config))
+         (remote-cache   (and remote-server
+                              (cuirass-remote-server-configuration-cache
+                               remote-server)))
+         (db             (dirname
+                          (cuirass-configuration-database config)))
+         (user           (cuirass-configuration-user config))
+         (log            "/var/log/cuirass")
+         (group          (cuirass-configuration-group config)))
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils))
@@ -256,11 +261,17 @@
           (mkdir-p #$db)
           (mkdir-p #$log)
 
+          (when #$remote-cache
+            (mkdir-p #$remote-cache))
+
           (let ((uid (passwd:uid (getpw #$user)))
                 (gid (group:gid (getgr #$group))))
             (chown #$cache uid gid)
             (chown #$db uid gid)
-            (chown #$log uid gid))))))
+            (chown #$log uid gid)
+
+            (when #$remote-cache
+              (chown #$remote-cache uid gid)))))))
 
 (define (cuirass-log-rotations config)
   "Return the list of log rotations that corresponds to CONFIG."