mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
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.
This commit is contained in:
parent
10d86d54f0
commit
009d831167
1 changed files with 14 additions and 1 deletions
|
@ -178,7 +178,20 @@ (define (partition-label-predicate label)
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue