[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
160/197: installer: New convenience procedures.
From: |
Danny Milosavljevic |
Subject: |
160/197: installer: New convenience procedures. |
Date: |
Mon, 3 Jul 2017 20:37:18 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 9c20b996785703101585d3f4bf0a9346c3d4ca3f
Author: John Darrington <address@hidden>
Date: Tue Jan 31 20:13:34 2017 +0100
installer: New convenience procedures.
* gnu/system/installer/format.scm (device-attributes): New procedure.
(device-fs-label): New procedure.
---
gnu/system/installer/format.scm | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/gnu/system/installer/format.scm b/gnu/system/installer/format.scm
index 29b8316..f0a9aaf 100644
--- a/gnu/system/installer/format.scm
+++ b/gnu/system/installer/format.scm
@@ -35,17 +35,28 @@
(include "i18n.scm")
+(define (device-attributes dev)
+ (slurp (string-append "blkid -o export " dev)
+ (lambda (x)
+ (let ((idx (string-index x #\=)))
+ (cons (string->symbol (string-fold
+ (lambda (c acc)
+ (string-append
+ acc
+ (make-string 1 (char-downcase c))))
+ ""
+ (substring x 0 idx)))
+ (substring x (1+ idx) (string-length x)))))))
+
(define (device-fs-uuid dev)
"Retrieve the UUID of the filesystem on DEV, where DEV is the name of the
device such as /dev/sda1"
- (match (assoc-ref
- (slurp (string-append "blkid -o export " dev)
- (lambda (x)
- (string-split x #\=))) "UUID")
- (() #f)
- ((? list? l)
- (car l))
- (_ #f)))
+ (assq-ref (device-attributes dev) 'uuid))
+
+(define (device-fs-label dev)
+ "Retrieve the LABEL of the filesystem on DEV, where DEV is the name of the
+device such as /dev/sda1"
+ (assq-ref (device-attributes dev) 'label))
(define (filesystems-are-current?)
"Returns #t iff there is at least one mount point AND all mount-points' uuids
- 120/197: gurses: Mini refactor., (continued)
- 120/197: gurses: Mini refactor., Danny Milosavljevic, 2017/07/03
- 124/197: gurses: Populate dropdown boxes in forms using a menu., Danny Milosavljevic, 2017/07/03
- 131/197: gurses: Use inverse instead of underline for field value area., Danny Milosavljevic, 2017/07/03
- 133/197: installer: Change livery., Danny Milosavljevic, 2017/07/03
- 146/197: gurses: Use match instead of car/cdr in line-split., Danny Milosavljevic, 2017/07/03
- 147/197: gurses: In paragraph-format avoid use of car and cdr., Danny Milosavljevic, 2017/07/03
- 144/197: gurses: Avoid one more use of car and cdr., Danny Milosavljevic, 2017/07/03
- 143/197: gurses: Add predicate to test if a complex char is blank., Danny Milosavljevic, 2017/07/03
- 149/197: gurses: Add new procedure "word-endings"., Danny Milosavljevic, 2017/07/03
- 155/197: installer: Use _ instead of M_ for host-name-refresh., Danny Milosavljevic, 2017/07/03
- 160/197: installer: New convenience procedures.,
Danny Milosavljevic <=
- 158/197: installer: Correct placement of gettext call., Danny Milosavljevic, 2017/07/03
- 163/197: gurses: Cache the windows of buttons., Danny Milosavljevic, 2017/07/03
- 172/197: gurses: Update the cursor position when posting the form., Danny Milosavljevic, 2017/07/03
- 165/197: installer: New procedure key-value-slurp., Danny Milosavljevic, 2017/07/03
- 175/197: gurses: Don't crash if asked for an item by an invalid index., Danny Milosavljevic, 2017/07/03
- 171/197: installer: New page to edit user accounts., Danny Milosavljevic, 2017/07/03
- 187/197: installer: Add procudure for starting a wireless interface., Danny Milosavljevic, 2017/07/03
- 192/197: installer: Only build if guile-ncurses is available., Danny Milosavljevic, 2017/07/03
- 68/197: installer: Add new page to set the system role., Danny Milosavljevic, 2017/07/03
- 117/197: installer: Remove unnecessary "begin"., Danny Milosavljevic, 2017/07/03