diff options
author | Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org> | 2019-08-06 13:37:32 -0400 |
---|---|---|
committer | Danny Milosavljevic <dannym@scratchpost.org> | 2019-08-06 22:21:13 +0200 |
commit | 5f04e9f9620aeb45940855e4f655f22db55ba6eb (patch) | |
tree | d4330c5ccc9c1c1b92e1cd83be2fde9b7975fca2 | |
parent | d97ce20400b5d2967bfbc0e9fbfb99bbb2daed4f (diff) | |
download | guix-5f04e9f9620aeb45940855e4f655f22db55ba6eb.tar.gz |
reconfigure: Fix GC root installation.
Fixes <https://bugs.gnu.org/36942>. Reported by ison <ison@airmail.cc>. guix/scripts/system/reconfigure.scm (install-bootloader-program): Switch new symlink to the canonical bootloader configuration file. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
-rw-r--r-- | guix/scripts/system/reconfigure.scm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm index dee0c24bd2..579b7fffbe 100644 --- a/guix/scripts/system/reconfigure.scm +++ b/guix/scripts/system/reconfigure.scm @@ -195,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 |