summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-10 10:25:56 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-10 10:31:25 +0200
commitaea9b23213b097eb689fdae1e8e9577bf71ebb8d (patch)
tree4d02fa35c6e52c5946e354171d31d13b7f0b205e /gnu/build
parent7522a0160be6888416a54b9e241d124839750e60 (diff)
downloadguix-aea9b23213b097eb689fdae1e8e9577bf71ebb8d.tar.gz
install: Really overwrite TARGET/var/guix/profiles/system-1-link.
* gnu/build/install.scm (populate-root-file-system): Delete system-1-link
  under TARGET, not under /.  Use 'catch' and check for EEXIST instead of
  (false-if-exception (delete-file ...)).
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/install.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnu/build/install.scm b/gnu/build/install.scm
index 76536daf49..32fbe8efbc 100644
--- a/gnu/build/install.scm
+++ b/gnu/build/install.scm
@@ -133,9 +133,19 @@ includes /etc, /var, /run, /bin/sh, etc., and all the symlinks to SYSTEM."
             (directives (%store-directory)))
 
   ;; Add system generation 1.
-  (false-if-exception (delete-file "/var/guix/profiles/system-1-link"))
-  (symlink system
-           (string-append target "/var/guix/profiles/system-1-link")))
+  (let ((generation-1 (string-append target
+                                     "/var/guix/profiles/system-1-link")))
+    (let try ()
+      (catch 'system-error
+        (lambda ()
+          (symlink system generation-1))
+        (lambda args
+          ;; If GENERATION-1 already exists, overwrite it.
+          (if (= EEXIST (system-error-errno args))
+              (begin
+                (delete-file generation-1)
+                (try))
+              (apply throw args)))))))
 
 (define (reset-timestamps directory)
   "Reset the timestamps of all the files under DIRECTORY, so that they appear