aboutsummaryrefslogtreecommitdiff
path: root/guix/build/install.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-18 22:06:38 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-18 22:27:23 +0200
commit6ffd11f129405c7bd663201096d8fcfcde6344a9 (patch)
tree98b46a8342818be2a20e6a37a6fa10ea076560d1 /guix/build/install.scm
parentd5b429abda948c21a61032a1da9d472410edaa90 (diff)
downloadgnu-guix-6ffd11f129405c7bd663201096d8fcfcde6344a9.tar
gnu-guix-6ffd11f129405c7bd663201096d8fcfcde6344a9.tar.gz
system: Prevent grub.cfg from being GC'd.
* guix/build/install.scm (install-grub): Use 'copy-file' instead of 'symlink' for GRUB.CFG.
Diffstat (limited to 'guix/build/install.scm')
-rw-r--r--guix/build/install.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/build/install.scm b/guix/build/install.scm
index 564735a7f6..f61c16f13a 100644
--- a/guix/build/install.scm
+++ b/guix/build/install.scm
@@ -38,11 +38,18 @@
(define* (install-grub grub.cfg device mount-point)
"Install GRUB with GRUB.CFG on DEVICE, which is assumed to be mounted on
MOUNT-POINT. Return #t on success."
- (mkdir-p (string-append mount-point "/boot/grub"))
- (symlink grub.cfg (string-append mount-point "/boot/grub/grub.cfg"))
- (zero? (system* "grub-install" "--no-floppy"
- "--boot-directory" (string-append mount-point "/boot")
- device)))
+ (let* ((target (string-append mount-point "/boot/grub/grub.cfg"))
+ (pivot (string-append target ".new")))
+ (mkdir-p (dirname target))
+
+ ;; Copy GRUB.CFG instead of just symlinking it since it's not a GC root.
+ ;; Do that atomically.
+ (copy-file grub.cfg pivot)
+ (rename-file pivot target)
+
+ (zero? (system* "grub-install" "--no-floppy"
+ "--boot-directory" (string-append mount-point "/boot")
+ device))))
(define (evaluate-populate-directive directive target)
"Evaluate DIRECTIVE, an sexp describing a file or directory to create under