mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-08 07:56:16 -05:00
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'.
This commit is contained in:
parent
8120b23e51
commit
71bf6cb700
1 changed files with 7 additions and 1 deletions
|
@ -148,12 +148,18 @@ (define* (copy-closure item target
|
|||
"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")))
|
||||
|
|
Loading…
Reference in a new issue