diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-07-02 23:59:52 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-07-03 00:39:11 +0200 |
commit | 71bf6cb700965cfe5b8f3661315017b022d0aca1 (patch) | |
tree | 1be861e92cdbd4ea24aaf542aad02997416ac7c4 /guix/scripts/system.scm | |
parent | 8120b23e51d8a21056cf982c6740234b8f858633 (diff) |
guix system: init: Check the available space before copying.
* guix/scripts/system.scm (copy-closure): Call 'query-path-info*' on
TO-COPY and REFS. Compute the total size. Call 'check-available-space'.
Diffstat (limited to 'guix/scripts/system.scm')
-rw-r--r-- | guix/scripts/system.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 14aedceac1..92e92237b6 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -148,12 +148,18 @@ REFERENCES as its set of references." "Copy ITEM and all its dependencies to the store under root directory TARGET, and register them." (mlet* %store-monad ((to-copy (topologically-sorted* (list item))) - (refs (mapm %store-monad references* to-copy))) + (refs (mapm %store-monad references* to-copy)) + (info (mapm %store-monad query-path-info* + (delete-duplicates + (append to-copy (concatenate refs))))) + (size -> (reduce + 0 (map path-info-nar-size info)))) (define progress-bar (progress-reporter/bar (length to-copy) (format #f (G_ "copying to '~a'...") target))) + (check-available-space size target) + (call-with-progress-reporter progress-bar (lambda (report) (let ((void (%make-void-port "w"))) |