summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-28 22:49:42 +0200
committerLudovic Courtès <ludo@gnu.org>2016-03-28 22:50:25 +0200
commit7f949db03e5dffa7873ce63723c0a92a28594511 (patch)
tree3e6acbc2a9c1b77f390427659c23e353eaae3d70
parente2f41133e9c9e597cd3e1be553aaef636c35f8b6 (diff)
guix system: Warn against missing 'guix pull'.
Suggested by Leo Famulari and others. * guix/scripts/system.scm (maybe-suggest-running-guix-pull): New procedure. (perform-action): Call it when ACTION is 'reconfigure.
-rw-r--r--guix/scripts/system.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 8ebeb4d5953..566e7e87689 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -482,6 +482,21 @@ PATTERN, a string. When PATTERN is #f, display all the system generations."
482 ((disk-image) 482 ((disk-image)
483 (system-disk-image os #:disk-image-size image-size)))) 483 (system-disk-image os #:disk-image-size image-size))))
484 484
485(define (maybe-suggest-running-guix-pull)
486 "Suggest running 'guix pull' if this has never been done before."
487 ;; The reason for this is that the 'guix' binding that we see here comes
488 ;; from either ~/.config/latest or, if it's missing, from the
489 ;; globally-installed Guix, which is necessarily older. See
490 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00057.html> for
491 ;; a discussion.
492 (define latest
493 (string-append (config-directory) "/latest"))
494
495 (unless (file-exists? latest)
496 (warning (_ "~a not found: 'guix pull' was never run~%") latest)
497 (warning (_ "Consider running 'guix pull' before 'reconfigure'.~%"))
498 (warning (_ "Failing to do that may downgrade your system!~%"))))
499
485(define* (perform-action action os 500(define* (perform-action action os
486 #:key grub? dry-run? derivations-only? 501 #:key grub? dry-run? derivations-only?
487 use-substitutes? device target 502 use-substitutes? device target
@@ -498,6 +513,9 @@ building anything."
498 (define println 513 (define println
499 (cut format #t "~a~%" <>)) 514 (cut format #t "~a~%" <>))
500 515
516 (when (eq? action 'reconfigure)
517 (maybe-suggest-running-guix-pull))
518
501 (mlet* %store-monad 519 (mlet* %store-monad
502 ((sys (system-derivation-for-action os action 520 ((sys (system-derivation-for-action os action
503 #:image-size image-size 521 #:image-size image-size