summaryrefslogtreecommitdiff
path: root/guix/scripts/system/reconfigure.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/scripts/system/reconfigure.scm')
-rw-r--r--guix/scripts/system/reconfigure.scm27
1 files changed, 16 insertions, 11 deletions
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
index 8c7d461585..579b7fffbe 100644
--- a/guix/scripts/system/reconfigure.scm
+++ b/guix/scripts/system/reconfigure.scm
@@ -161,12 +161,7 @@ services as defined by OS."
target-services)
(map live-service-canonical-name
live-services)))
- (service-files
- (map shepherd-service-file
- (filter (lambda (service)
- (memq (shepherd-service-canonical-name service)
- to-start))
- target-services))))
+ (service-files (map shepherd-service-file target-services)))
(eval #~(primitive-load #$(upgrade-services-program service-files
to-start
to-unload
@@ -200,21 +195,31 @@ BOOTLOADER-PACKAGE."
(srfi srfi-34)
(srfi srfi-35))
(let* ((gc-root (string-append #$target %gc-roots-directory "/bootcfg"))
- (temp-gc-root (string-append gc-root ".new")))
- (switch-symlinks temp-gc-root gc-root)
- (install-boot-config #$bootcfg #$bootcfg-file #$target)
+ (new-gc-root (string-append gc-root ".new")))
+ ;; #$bootcfg has dependencies.
+ ;; The bootloader magically loads the configuration from
+ ;; (string-append #$target #$bootcfg-file) (for example
+ ;; "/boot/grub/grub.cfg").
+ ;; If we didn't do something special, the garbage collector
+ ;; would remove the dependencies of #$bootcfg.
+ ;; Register #$bootcfg as a GC root.
;; Preserve the previous activation's garbage collector root
;; until the bootloader installer has run, so that a failure in
;; the bootloader's installer script doesn't leave the user with
;; a broken installation.
+ (switch-symlinks new-gc-root #$bootcfg)
+ (install-boot-config #$bootcfg #$bootcfg-file #$target)
(when #$installer
(catch #t
(lambda ()
(#$installer #$bootloader-package #$device #$target))
(lambda args
- (delete-file temp-gc-root)
+ (delete-file new-gc-root)
(apply throw args))))
- (rename-file temp-gc-root gc-root)))))))
+ ;; We are sure that the installation of the bootloader
+ ;; succeeded, so we can replace the old GC root by the new
+ ;; GC root now.
+ (rename-file new-gc-root gc-root)))))))
(define* (install-bootloader eval configuration bootcfg
#:key