[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/10] Factor out procedure: install-grub-config
From: |
cmmarusich |
Subject: |
[PATCH 07/10] Factor out procedure: install-grub-config |
Date: |
Fri, 28 Oct 2016 03:07:24 -0700 |
From: Chris Marusich <address@hidden>
* gnu/build/install (install-grub, install-grub-config): Extract code from
'install-grub' into a new procedure 'install-grub-config'. Also, define
'install-grub' using define, not define*, since it makes no use of the extra
features that define* provides.
---
gnu/build/install.scm | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/gnu/build/install.scm b/gnu/build/install.scm
index 7431a09..3d1594e 100644
--- a/gnu/build/install.scm
+++ b/gnu/build/install.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016 Chris Marusich <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,6 +23,7 @@
#:use-module (srfi srfi-26)
#:use-module (ice-9 match)
#:export (install-grub
+ install-grub-config
populate-root-file-system
reset-timestamps
register-closure
@@ -36,13 +38,24 @@
;;;
;;; Code:
-(define* (install-grub grub.cfg device mount-point)
+(define (install-grub grub.cfg device mount-point)
"Install GRUB with GRUB.CFG on DEVICE, which is assumed to be mounted on
MOUNT-POINT.
Note that the caller must make sure that GRUB.CFG is registered as a GC root
so that the fonts, background images, etc. referred to by GRUB.CFG are not
GC'd."
+ (install-grub-config grub.cfg mount-point)
+ (unless (zero? (system* "grub-install" "--no-floppy"
+ "--boot-directory"
+ (string-append mount-point "/boot")
+ device))
+ (error "failed to install GRUB")))
+
+(define (install-grub-config grub.cfg mount-point)
+ "Atomically copy GRUB.CFG into boot/grub/grub.cfg on the MOUNT-POINT. Note
+that the caller must make sure that GRUB.CFG is registered as a GC root so
+that the fonts, background images, etc. referred to by GRUB.CFG are not GC'd."
(let* ((target (string-append mount-point "/boot/grub/grub.cfg"))
(pivot (string-append target ".new")))
(mkdir-p (dirname target))
@@ -50,13 +63,7 @@ GC'd."
;; Copy GRUB.CFG instead of just symlinking it, because symlinks won't
;; work when /boot is on a separate partition. Do that atomically.
(copy-file grub.cfg pivot)
- (rename-file pivot target)
-
- (unless (zero? (system* "grub-install" "--no-floppy"
- "--boot-directory"
- (string-append mount-point "/boot")
- device))
- (error "failed to install GRUB"))))
+ (rename-file pivot target)))
(define (evaluate-populate-directive directive target)
"Evaluate DIRECTIVE, an sexp describing a file or directory to create under
--
2.9.2
- Add system roll-back and switch-generation commands, cmmarusich, 2016/10/28
- [PATCH 01/10] * gnu/system.scm (<boot-parameters>): Add 'store-device' and 'store-fs-mount-point'., cmmarusich, 2016/10/28
- [PATCH 05/10] Rename previous-grub-entries to grub-entries, cmmarusich, 2016/10/28
- [PATCH 07/10] Factor out procedure: install-grub-config,
cmmarusich <=
- [PATCH 06/10] grub-entries: take a list of numbers on input, cmmarusich, 2016/10/28
- [PATCH 03/10] Refactor grub.cfg generation logic, cmmarusich, 2016/10/28
- [PATCH 09/10] Rename grub-entries to profile-grub-entries, cmmarusich, 2016/10/28
- [PATCH 02/10] Add 'device' field to <menu-entry>, cmmarusich, 2016/10/28
- [PATCH 04/10] Extract procedure: relative-generation-spec->number, cmmarusich, 2016/10/28
- [PATCH 10/10] Mention new 'guix system' features in the manual, cmmarusich, 2016/10/28
- [PATCH 08/10] Implement switch-generation and roll-back, cmmarusich, 2016/10/28
- Re: Add system roll-back and switch-generation commands, Ludovic Courtès, 2016/10/29