Skip to content
Snippets Groups Projects
Unverified Commit f3f1d0a5 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

guix system: Make 'init' idempotent again.

This fixes a regression introduced in
df2f6400: since the new
'register-path' (actually 'reset-timestamps') would make files
read-only, 'delete-file-recursively' would fail to delete them.  Thus,
re-running 'guix system init' on an already-populated store would fail
with a 'delete-file' EPERM.

* guix/scripts/system.scm (copy-item): Use 'lstat' instead of
'file-exists?'.  Call 'make-file-writable' on each directory below
DEST.
parent 90b144d2
No related branches found
No related tags found
No related merge requests found
......@@ -126,7 +126,11 @@ (define* (copy-item item references target
;; 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)
(when (false-if-exception (lstat dest))
(for-each make-file-writable
(find-files dest (lambda (file stat)
(eq? 'directory (stat:type stat)))
#:directories? #t))
(delete-file-recursively dest))
(copy-recursively item dest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment