mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
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.
This commit is contained in:
parent
ddfc2fd8e0
commit
6d49355d8b
2 changed files with 9 additions and 1 deletions
|
@ -236,8 +236,13 @@ (define (boot-time-system)
|
||||||
"Return the '--system' argument passed on the kernel command line."
|
"Return the '--system' argument passed on the kernel command line."
|
||||||
(find-long-option "--system" (linux-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."
|
"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)
|
(format #t "making '~a' the current system...~%" system)
|
||||||
|
|
||||||
;; Atomically make SYSTEM current.
|
;; Atomically make SYSTEM current.
|
||||||
|
|
|
@ -199,6 +199,9 @@ (define* (switch-to-system os
|
||||||
;; The activation script may change $PATH, among others, so protect
|
;; The activation script may change $PATH, among others, so protect
|
||||||
;; against that.
|
;; against that.
|
||||||
(return (save-environment-excursion
|
(return (save-environment-excursion
|
||||||
|
;; Tell 'activate-current-system' what the new system is.
|
||||||
|
(setenv "GUIX_NEW_SYSTEM" system)
|
||||||
|
|
||||||
(primitive-load (derivation->output-path script))))
|
(primitive-load (derivation->output-path script))))
|
||||||
|
|
||||||
;; TODO: Run 'deco reload ...'.
|
;; TODO: Run 'deco reload ...'.
|
||||||
|
|
Loading…
Reference in a new issue