summary refs log tree commit diff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-09 11:06:22 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-09 11:06:50 +0100
commit6412e58a6843aaec573a65bacf58308ac4ee9035 (patch)
tree92436fe36dd881ea007db92fbde656e7093b8dcd /gnu/build/vm.scm
parentf6d9b3ded7642260915e2217b856c376940e2aa3 (diff)
downloadguix-6412e58a6843aaec573a65bacf58308ac4ee9035.tar.gz
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 <nikita@karetnikov.org> in <http://bugs.gnu.org/19220>.
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.
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm19
1 files changed, 6 insertions, 13 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 1762582343..2c53cf5dd9 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -178,17 +178,11 @@ volume name."
   (display "populating...\n")
   (populate-root-file-system system-directory target-directory))
 
-(define (register-grub.cfg-root target)
-  "On file system TARGET, make '/boot/grub/grub.cfg' an indirect GC root."
-  (define hash
-    ;; XXX: Believe it or not, this is that nix-base32-encoded SHA1 of the
-    ;; string "/boot/grub/grub.cfg".  We need it here, but gcrypt isn't
-    ;; available (a random hash would do as well, though.)
-    "kv0yq1d48kavqfhjfzvc4lcyazx2mqhv")
-
-  (let ((directory (string-append target "/var/guix/gcroots/auto")))
+(define (register-grub.cfg-root target grub.cfg)
+  "On file system TARGET, register GRUB.CFG as a GC root."
+  (let ((directory (string-append target "/var/guix/gcroots")))
     (mkdir-p directory)
-    (symlink "/boot/grub/grub.cfg" (string-append directory "/" hash))))
+    (symlink grub.cfg (string-append directory "/grub.cfg"))))
 
 (define* (initialize-hard-disk device
                                #:key
@@ -234,9 +228,8 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
 
   (install-grub grub.cfg device target-directory)
 
-  ;; Register $target/boot/grub/grub.cfg as an indirect root, so that GRUB.CFG
-  ;; is not reclaimed.
-  (register-grub.cfg-root target-directory)
+  ;; Register GRUB.CFG as a GC root.
+  (register-grub.cfg-root target-directory grub.cfg)
 
   ;; 'guix-register' resets timestamps and everything, so no need to do it
   ;; once more in that case.