From 6412e58a6843aaec573a65bacf58308ac4ee9035 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 Dec 2014 11:06:22 +0100 Subject: system: Don't make /boot/grub/grub.cfg a symlink to the store. This would not work when /boot is a separate partition, as reported by Nikita Karetnikov in . This fixes a regression introduced in 39d1f82. * gnu/build/install.scm (install-grub): Copy GRUB.CFG instead of symlinking it, as was the case before 39d1f82. * gnu/build/vm.scm (register-grub.cfg-root): Add 'grub.cfg' parameter. Make it a permanent GC root instead of an indirect GC root. (initialize-hard-disk): Adjust accordingly. * guix/scripts/system.scm (install-grub*): Replace use of 'add-indirect-root' by the addition of a permanent GC root in %GC-ROOTS-DIRECTORY. --- guix/scripts/system.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 6a2586086e..27404772b7 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -134,14 +134,23 @@ TARGET, and register them." (define (install-grub* grub.cfg device target) "This is a variant of 'install-grub' with error handling, lifted in %STORE-MONAD" - (let ((add-root (store-lift add-indirect-root))) + (let* ((gc-root (string-append %gc-roots-directory "/grub.cfg")) + (temp-gc-root (string-append gc-root ".new")) + (delete-file (lift1 delete-file %store-monad)) + (make-symlink (lift2 switch-symlinks %store-monad)) + (rename (lift2 rename-file %store-monad))) (mbegin %store-monad + ;; Prepare the symlink to GRUB.CFG to make sure that it's a GC root when + ;; 'install-grub' completes (being a bit paranoid.) + (make-symlink temp-gc-root grub.cfg) + (munless (false-if-exception (install-grub grub.cfg device target)) + (delete-file temp-gc-root) (leave (_ "failed to install GRUB on device '~a'~%") device)) ;; Register GRUB.CFG as a GC root so that its dependencies (background ;; image, font, etc.) are not reclaimed. - (add-root "/boot/grub/grub.cfg")))) + (rename temp-gc-root gc-root)))) (define* (install os-drv target #:key (log-port (current-output-port)) -- cgit v1.2.3