summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-09 15:12:30 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-09 23:04:14 +0100
commit7c34c62c807b357b5cdad6fde0f11c9fe93279d0 (patch)
treecb84c4d9d91d4088253a3125279dd7b54eaec43c /gnu
parent1ce0d7e190784c709abf3346d8d94e7e143569dc (diff)
downloadguix-7c34c62c807b357b5cdad6fde0f11c9fe93279d0.tar.gz
services: hpcguix-web: Delete lock files during activation.
* gnu/services/web.scm (%hpcguix-web-activation): Delete ".lock" files
from HOME-DIR.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/web.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index d0c9d0df2b..3d149a105d 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -1049,13 +1049,22 @@ a webserver.")
 (define %hpcguix-web-activation
   (with-imported-modules '((guix build utils))
     #~(begin
-        (use-modules (guix build utils))
+        (use-modules (guix build utils)
+                     (ice-9 ftw))
 
         (let ((home-dir "/var/cache/guix/web")
               (user (getpwnam "hpcguix-web")))
           (mkdir-p home-dir)
           (chown home-dir (passwd:uid user) (passwd:gid user))
-          (chmod home-dir #o755)))))
+          (chmod home-dir #o755)
+
+          ;; Remove stale 'packages.json.lock' file (and other lock files, if
+          ;; any) since that would prevent 'packages.json' from being updated.
+          (for-each (lambda (lock)
+                      (delete-file (string-append home-dir "/" lock)))
+                    (scandir home-dir
+                             (lambda (file)
+                               (string-suffix? ".lock" file))))))))
 
 (define %hpcguix-web-log-file
   "/var/log/hpcguix-web.log")