summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-12-01 14:09:38 +0100
committerMathieu Othacehe <m.othacehe@gmail.com>2017-12-04 18:26:59 +0100
commit4307397b5e060b54d69b7d2818654504ebde9c1d (patch)
tree220be063b26be9ce8cfa4a94bc016cf3450f85d8
parent39b27f4eae36d155faf466c59629afb5843030e6 (diff)
downloadgnu-guix-4307397b5e060b54d69b7d2818654504ebde9c1d.tar
gnu-guix-4307397b5e060b54d69b7d2818654504ebde9c1d.tar.gz
bootloader: extlinux: Stop using dd binary.
* gnu/bootloader/extlinux.scm (dd): Remove it, (install-extlinux): replace dd call by Guile I/O procedures. * gnu/system/vm.scm (qemu-image): Add (ice-9 binary-ports) to used-modules list to provide "get-bytevector-n" and "put-bytevector". * guix/scripts/system.scm (bootloader-installer-derivation): Ditto.
-rw-r--r--gnu/bootloader/extlinux.scm20
-rw-r--r--gnu/system/vm.scm3
-rw-r--r--guix/scripts/system.scm3
3 files changed, 13 insertions, 13 deletions
diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 0db5598fc9..9b6e2c7f2a 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -85,14 +85,6 @@ TIMEOUT ~a~%"
;;; Install procedures.
;;;
-(define dd
- #~(lambda (bs count if of)
- (zero? (system* "dd"
- (string-append "bs=" (number->string bs))
- (string-append "count=" (number->string count))
- (string-append "if=" if)
- (string-append "of=" of)))))
-
(define (install-extlinux mbr)
#~(lambda (bootloader device mount-point)
(let ((extlinux (string-append bootloader "/sbin/extlinux"))
@@ -101,9 +93,15 @@ TIMEOUT ~a~%"
(for-each (lambda (file)
(install-file file install-dir))
(find-files syslinux-dir "\\.c32$"))
-
- (unless (and (zero? (system* extlinux "--install" install-dir))
- (#$dd 440 1 (string-append syslinux-dir "/" #$mbr) device))
+ (unless
+ (and (zero? (system* extlinux "--install" install-dir))
+ (call-with-input-file (string-append syslinux-dir "/" #$mbr)
+ (lambda (input)
+ (let ((bv (get-bytevector-n input 440)))
+ (call-with-output-file device
+ (lambda (output)
+ (put-bytevector output bv))
+ #:binary #t)))))
(error "failed to install SYSLINUX")))))
(define install-extlinux-mbr
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index b68cce3eb5..d754ac76f0 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -278,7 +278,8 @@ the image."
#~(begin
(use-modules (gnu build vm)
(guix build utils)
- (srfi srfi-26))
+ (srfi srfi-26)
+ (ice-9 binary-ports))
(let ((inputs
'#$(append (list qemu parted e2fsprogs dosfstools)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 91d151d22b..e2ff42693f 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -676,7 +676,8 @@ and TARGET arguments."
(gexp->file "bootloader-installer"
(with-imported-modules '((guix build utils))
#~(begin
- (use-modules (guix build utils))
+ (use-modules (guix build utils)
+ (ice-9 binary-ports))
(#$installer #$bootloader #$device #$target))))))
(define* (perform-action action os