mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
file-systems: Add a 'file-system-device->string' procedure.
* gnu/system/file-systems.scm (file-system-device->string): New procedure. * gnu/system.scm (bootable-kernel-arguments): Use it. * gnu/system/vm.scm (operating-system-uuid): Likewise. * guix/scripts/system.scm (display-system-generation): Likewise.
This commit is contained in:
parent
cc9b889e8f
commit
99e676db43
4 changed files with 22 additions and 23 deletions
|
@ -142,16 +142,11 @@ (define-module (gnu system)
|
|||
(define (bootable-kernel-arguments system root-device)
|
||||
"Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
|
||||
(list (string-append "--root="
|
||||
(cond ((uuid? root-device)
|
||||
|
||||
;; Note: Always use the DCE format because that's
|
||||
;; what (gnu build linux-boot) expects for the
|
||||
;; '--root' kernel command-line option.
|
||||
(uuid->string (uuid-bytevector root-device)
|
||||
'dce))
|
||||
((file-system-label? root-device)
|
||||
(file-system-label->string root-device))
|
||||
(else root-device)))
|
||||
;; Note: Always use the DCE format because that's what
|
||||
;; (gnu build linux-boot) expects for the '--root'
|
||||
;; kernel command-line option.
|
||||
(file-system-device->string root-device
|
||||
#:uuid-type 'dce))
|
||||
#~(string-append "--system=" #$system)
|
||||
#~(string-append "--load=" #$system "/boot")))
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ (define-module (gnu system file-systems)
|
|||
#:export (file-system
|
||||
file-system?
|
||||
file-system-device
|
||||
file-system-device->string
|
||||
file-system-title ;deprecated
|
||||
file-system-mount-point
|
||||
file-system-type
|
||||
|
@ -235,6 +236,20 @@ (define (file-prefix? file1 file2)
|
|||
(()
|
||||
#f)))))))
|
||||
|
||||
(define* (file-system-device->string device #:key uuid-type)
|
||||
"Return the string representations of the DEVICE field of a <file-system>
|
||||
record. When the device is a UUID, its representation is chosen depending on
|
||||
UUID-TYPE, a symbol such as 'dce or 'iso9660."
|
||||
(match device
|
||||
((? file-system-label?)
|
||||
(file-system-label->string device))
|
||||
((? uuid?)
|
||||
(if uuid-type
|
||||
(uuid->string (uuid-bytevector device) uuid-type)
|
||||
(uuid->string device)))
|
||||
((? string?)
|
||||
device)))
|
||||
|
||||
(define (file-system-needed-for-boot? fs)
|
||||
"Return true if FS has the 'needed-for-boot?' flag set, or if it holds the
|
||||
store--e.g., if FS is the root file system."
|
||||
|
|
|
@ -609,13 +609,7 @@ (define (file-system-digest fs)
|
|||
(let ((device (file-system-device fs)))
|
||||
(list (file-system-mount-point fs)
|
||||
(file-system-type fs)
|
||||
(cond ((file-system-label? device)
|
||||
(file-system-label->string device))
|
||||
((uuid? device)
|
||||
(uuid->string device))
|
||||
((string? device)
|
||||
device)
|
||||
(else #f))
|
||||
(file-system-device->string device)
|
||||
(file-system-options fs))))
|
||||
|
||||
(if (eq? type 'iso9660)
|
||||
|
|
|
@ -517,12 +517,7 @@ (define (display-channel channel)
|
|||
(cond ((uuid? root-device) 0)
|
||||
((file-system-label? root-device) 1)
|
||||
(else 2))
|
||||
(cond ((uuid? root-device)
|
||||
(uuid->string root-device))
|
||||
((file-system-label? root-device)
|
||||
(file-system-label->string root-device))
|
||||
(else
|
||||
root-device)))
|
||||
(file-system-device->string root-device))
|
||||
|
||||
(format #t (G_ " kernel: ~a~%") kernel)
|
||||
|
||||
|
|
Loading…
Reference in a new issue