summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-03-24 18:12:30 +0100
committerLudovic Courtès <ludo@gnu.org>2020-03-24 18:54:41 +0100
commit637db76d7ad1af5323a6a6b87b8a6a2e6dfed754 (patch)
treeda0b5b002a8ae926a0377a62bd552f874db4c722
parent72a5cc53586080e75ae4ee80f3a2467ff30c4f5e (diff)
guix system: Fix mistaken 'guix pull' warning upon 'reconfigure'.
Fixes <https://bugs.gnu.org/38196>. Reported by Florian Pelz <pelzflorian@pelzflorian.de>. * guix/scripts/system.scm (maybe-suggest-running-guix-pull): Check whether 'current-profile' returns true instead of checking for the existence of ~root/.config/guix/current. That way, "sudo guix system reconfigure" no longer emits a warning in that case.
-rw-r--r--guix/scripts/system.scm16
1 files changed, 6 insertions, 10 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 8d1938281a..61a3c95dbd 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -27,6 +27,7 @@
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module (guix store)
#:autoload (guix store database) (register-path)
+ #:use-module (guix describe)
#:use-module (guix grafts)
#:use-module (guix gexp)
#:use-module (guix derivations)
@@ -718,16 +719,11 @@ checking this by themselves in their 'check' procedure."
(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
- ;; <http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00057.html> for
- ;; a discussion.
- (define latest
- (string-append (config-directory) "/current"))
-
- (unless (file-exists? latest)
- (warning (G_ "~a not found: 'guix pull' was never run~%") latest)
+ ;; Check whether we're running a 'guix pull'-provided 'guix' command. When
+ ;; 'current-profile' returns #f, we may be running the globally-installed
+ ;; 'guix' and thus run the risk of deploying an older 'guix'. See
+ ;; <https://lists.gnu.org/archive/html/guix-devel/2014-08/msg00057.html>
+ (unless (or (current-profile) (getenv "GUIX_UNINSTALLED"))
(warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%"))
(warning (G_ "Failing to do that may downgrade your system!~%"))))