aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-01 21:20:54 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-01 21:20:54 +0200
commit009d831167edd37acdfc3f6a5c35618fc82804e4 (patch)
tree513fcf08fec543b23c268eef6c536c2a317a5e2e
parent10d86d54f05ab8e1ed98cd2f29af9f1864fc7316 (diff)
downloadguix-009d831167edd37acdfc3f6a5c35618fc82804e4.tar
guix-009d831167edd37acdfc3f6a5c35618fc82804e4.tar.gz
linux-initrd: Gracefully handle missing /dev nodes.
* guix/build/linux-initrd.scm (partition-label-predicate): Catch 'system-error' around 'read-ext2-superblock'; return #f upon ENOENT.
-rw-r--r--guix/build/linux-initrd.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm
index 1c44c5c5c7..9a13e7213c 100644
--- a/guix/build/linux-initrd.scm
+++ b/guix/build/linux-initrd.scm
@@ -178,7 +178,20 @@ if DEVICE does not contain an ext2 file system."
return #t if that partition's volume name is LABEL."
(lambda (part)
(let* ((device (string-append "/dev/" part))
- (sblock (read-ext2-superblock device)))
+ (sblock (catch 'system-error
+ (lambda ()
+ (read-ext2-superblock device))
+ (lambda args
+ ;; When running on the hand-made /dev,
+ ;; 'disk-partitions' could return partitions for which
+ ;; we have no /dev node. Handle that gracefully.
+ (if (= ENOENT (system-error-errno args))
+ (begin
+ (format (current-error-port)
+ "warning: device '~a' not found~%"
+ device)
+ #f)
+ (apply throw args))))))
(and sblock
(let ((volume (ext2-superblock-volume-name sblock)))
(and volume