From 6d49355d8b69869ba46c7ca6a98eafc5dc6c4c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 12 Sep 2014 17:41:06 +0200 Subject: [PATCH] activation: Honor $GUIX_NEW_SYSTEM for use by 'guix system reconfigure'. * gnu/build/activation.scm (activate-current-system): Honor $GUIX_NEW_SYSTEM by default. * guix/scripts/system.scm (switch-to-system): Set $GUIX_NEW_SYSTEM before loading SCRIPT. --- gnu/build/activation.scm | 7 ++++++- guix/scripts/system.scm | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 04dd19f3e1..16805b9bc6 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -236,8 +236,13 @@ (define (boot-time-system) "Return the '--system' argument passed on the kernel command line." (find-long-option "--system" (linux-command-line))) -(define* (activate-current-system #:optional (system (boot-time-system))) +(define* (activate-current-system + #:optional (system (or (getenv "GUIX_NEW_SYSTEM") + (boot-time-system)))) "Atomically make SYSTEM the current system." + ;; The 'GUIX_NEW_SYSTEM' environment variable is used as a way for 'guix + ;; system reconfigure' to pass the file name of the new system. + (format #t "making '~a' the current system...~%" system) ;; Atomically make SYSTEM current. diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7c0dde9030..056c8e6d30 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -199,6 +199,9 @@ (define* (switch-to-system os ;; The activation script may change $PATH, among others, so protect ;; against that. (return (save-environment-excursion + ;; Tell 'activate-current-system' what the new system is. + (setenv "GUIX_NEW_SYSTEM" system) + (primitive-load (derivation->output-path script)))) ;; TODO: Run 'deco reload ...'.