mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-26 04:29:25 -05:00
mapped-devices: raid-device-mapping: Avoid non-top-level 'use-modules'.
Fixes <http://bugs.gnu.org/24135>. Reported by myglc2 <myglc2@gmail.com>. * gnu/system/mapped-devices.scm (open-raid-device): Avoid non-top-level 'use-modules' form.
This commit is contained in:
parent
9d1e56b76d
commit
10618627bf
1 changed files with 17 additions and 14 deletions
|
@ -131,23 +131,26 @@ (define luks-device-mapping
|
||||||
(define (open-raid-device sources target)
|
(define (open-raid-device sources target)
|
||||||
"Return a gexp that assembles SOURCES (a list of devices) to the RAID device
|
"Return a gexp that assembles SOURCES (a list of devices) to the RAID device
|
||||||
TARGET (e.g., \"/dev/md0\"), using 'mdadm'."
|
TARGET (e.g., \"/dev/md0\"), using 'mdadm'."
|
||||||
#~(begin
|
#~(let ((sources '#$sources)
|
||||||
(use-modules (srfi srfi-1) (ice-9 format))
|
|
||||||
|
|
||||||
(let ((sources '#$sources))
|
;; XXX: We're not at the top level here. We could use a
|
||||||
(let loop ((attempts 0))
|
;; non-top-level 'use-modules' form but that doesn't work when the
|
||||||
(unless (every file-exists? sources)
|
;; code is eval'd, like the Shepherd does.
|
||||||
(when (> attempts 20)
|
(every (@ (srfi srfi-1) every))
|
||||||
(error "RAID devices did not show up; bailing out"
|
(format (@ (ice-9 format) format)))
|
||||||
sources))
|
(let loop ((attempts 0))
|
||||||
|
(unless (every file-exists? sources)
|
||||||
|
(when (> attempts 20)
|
||||||
|
(error "RAID devices did not show up; bailing out"
|
||||||
|
sources))
|
||||||
|
|
||||||
(format #t "waiting for RAID source devices~{ ~a~}...~%"
|
(format #t "waiting for RAID source devices~{ ~a~}...~%"
|
||||||
sources)
|
sources)
|
||||||
(sleep 1)
|
(sleep 1)
|
||||||
(loop (+ 1 attempts))))
|
(loop (+ 1 attempts))))
|
||||||
|
|
||||||
(zero? (system* (string-append #$mdadm "/sbin/mdadm")
|
(zero? (system* (string-append #$mdadm "/sbin/mdadm")
|
||||||
"--assemble" #$target sources)))))
|
"--assemble" #$target sources))))
|
||||||
|
|
||||||
(define (close-raid-device sources target)
|
(define (close-raid-device sources target)
|
||||||
"Return a gexp that stops the RAID device TARGET."
|
"Return a gexp that stops the RAID device TARGET."
|
||||||
|
|
Loading…
Reference in a new issue