aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-10 10:31:47 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-10 10:31:47 +0200
commit78acff7c11507c68b63ad289b2bbe396602b9dcf (patch)
tree3c1df9e3e78076adbb77412f5ab4988de31bb394
parentaea9b23213b097eb689fdae1e8e9577bf71ebb8d (diff)
downloadguix-78acff7c11507c68b63ad289b2bbe396602b9dcf.tar
guix-78acff7c11507c68b63ad289b2bbe396602b9dcf.tar.gz
guix system: init: Overwrite the items in the target store.
Fixes <http://bugs.gnu.org/20722>. Reported by Eric Bavier <ericbavier@openmailbox.org>. * guix/scripts/system.scm (copy-item): Check whether DEST exists and remove it if it does.
-rw-r--r--guix/scripts/system.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index f7c9d83e9a..aa9b3f838a 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -76,6 +76,13 @@
(let ((dest (string-append target item))
(state (string-append target "/var/guix")))
(format log-port "copying '~a'...~%" item)
+
+ ;; Remove DEST if it exists to make sure that (1) we do not fail badly
+ ;; while trying to overwrite it (see <http://bugs.gnu.org/20722>), and
+ ;; (2) we end up with the right contents.
+ (when (file-exists? dest)
+ (delete-file-recursively dest))
+
(copy-recursively item dest
#:log (%make-void-port "w"))