From 7f949db03e5dffa7873ce63723c0a92a28594511 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 28 Mar 2016 22:49:42 +0200 Subject: 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. --- guix/scripts/system.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 8ebeb4d595..566e7e8768 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -482,6 +482,21 @@ (define* (system-derivation-for-action os action ((disk-image) (system-disk-image os #:disk-image-size image-size)))) +(define (maybe-suggest-running-guix-pull) + "Suggest running 'guix pull' if this has never been done before." + ;; The reason for this is that the 'guix' binding that we see here comes + ;; from either ~/.config/latest or, if it's missing, from the + ;; globally-installed Guix, which is necessarily older. See + ;; for + ;; a discussion. + (define latest + (string-append (config-directory) "/latest")) + + (unless (file-exists? latest) + (warning (_ "~a not found: 'guix pull' was never run~%") latest) + (warning (_ "Consider running 'guix pull' before 'reconfigure'.~%")) + (warning (_ "Failing to do that may downgrade your system!~%")))) + (define* (perform-action action os #:key grub? dry-run? derivations-only? use-substitutes? device target @@ -498,6 +513,9 @@ (define* (perform-action action os (define println (cut format #t "~a~%" <>)) + (when (eq? action 'reconfigure) + (maybe-suggest-running-guix-pull)) + (mlet* %store-monad ((sys (system-derivation-for-action os action #:image-size image-size -- cgit v1.2.3