diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-08-03 00:07:06 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-08-03 00:07:06 +0200 |
| commit | 10618627bfe210f4ec84ab3018f12840704a11e0 (patch) | |
| tree | cd04aeec151c987a2f2178ce9a0a027ae244b468 | |
| parent | 9d1e56b76dc225373598d8d92c9d5f75eeba49ee (diff) | |
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.
| -rw-r--r-- | gnu/system/mapped-devices.scm | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index ce0a78a2ad5..7b91fcfc41a 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm | |||
| @@ -131,23 +131,26 @@ | |||
| 131 | (define (open-raid-device sources target) | 131 | (define (open-raid-device sources target) |
| 132 | "Return a gexp that assembles SOURCES (a list of devices) to the RAID device | 132 | "Return a gexp that assembles SOURCES (a list of devices) to the RAID device |
| 133 | TARGET (e.g., \"/dev/md0\"), using 'mdadm'." | 133 | TARGET (e.g., \"/dev/md0\"), using 'mdadm'." |
| 134 | #~(begin | 134 | #~(let ((sources '#$sources) |
| 135 | (use-modules (srfi srfi-1) (ice-9 format)) | 135 | |
| 136 | 136 | ;; XXX: We're not at the top level here. We could use a | |
| 137 | (let ((sources '#$sources)) | 137 | ;; non-top-level 'use-modules' form but that doesn't work when the |
| 138 | (let loop ((attempts 0)) | 138 | ;; code is eval'd, like the Shepherd does. |
| 139 | (unless (every file-exists? sources) | 139 | (every (@ (srfi srfi-1) every)) |
| 140 | (when (> attempts 20) | 140 | (format (@ (ice-9 format) format))) |
| 141 | (error "RAID devices did not show up; bailing out" | 141 | (let loop ((attempts 0)) |
| 142 | sources)) | 142 | (unless (every file-exists? sources) |
| 143 | 143 | (when (> attempts 20) | |
| 144 | (format #t "waiting for RAID source devices~{ ~a~}...~%" | 144 | (error "RAID devices did not show up; bailing out" |
| 145 | sources) | 145 | sources)) |
| 146 | (sleep 1) | 146 | |
| 147 | (loop (+ 1 attempts)))) | 147 | (format #t "waiting for RAID source devices~{ ~a~}...~%" |
| 148 | 148 | sources) | |
| 149 | (zero? (system* (string-append #$mdadm "/sbin/mdadm") | 149 | (sleep 1) |
| 150 | "--assemble" #$target sources))))) | 150 | (loop (+ 1 attempts)))) |
| 151 | |||
| 152 | (zero? (system* (string-append #$mdadm "/sbin/mdadm") | ||
| 153 | "--assemble" #$target sources)))) | ||
| 151 | 154 | ||
| 152 | (define (close-raid-device sources target) | 155 | (define (close-raid-device sources target) |
| 153 | "Return a gexp that stops the RAID device TARGET." | 156 | "Return a gexp that stops the RAID device TARGET." |
