[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
178/197: installer: Infer likely entries for user accounts from the geco
From: |
Danny Milosavljevic |
Subject: |
178/197: installer: Infer likely entries for user accounts from the gecos field. |
Date: |
Mon, 3 Jul 2017 20:37:21 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 34e2119f7873d2f8d36dbeec30084f78f644bdb2
Author: John Darrington <address@hidden>
Date: Mon Feb 13 09:15:54 2017 +0100
installer: Infer likely entries for user accounts from the gecos field.
* gnu/system/installer/user-edit.scm (user-edit-page-init): Add a
callback expression to the form constructor.
---
gnu/system/installer/user-edit.scm | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/gnu/system/installer/user-edit.scm
b/gnu/system/installer/user-edit.scm
index 23c1587..7adf88a 100644
--- a/gnu/system/installer/user-edit.scm
+++ b/gnu/system/installer/user-edit.scm
@@ -129,8 +129,29 @@
(getmaxx (inner pr))
(getmaxy text-window) 0 #:panel #f))
- (form (make-form (my-fields))))
-
+ (form (make-form (my-fields)
+ (lambda (frm)
+ ;; Infer the most likely desired values of the
+ ;; name and home fields from the other field values
+ (let* ((f (get-current-field frm))
+ (fv (form-get-value frm (field-symbol f)))
+ (brk (string-index fv #\space))
+ (first
+ (and brk
+ (string-map char-downcase
+ (string-take fv brk)))))
+ (cond ((eq? (field-symbol f) 'comment)
+ (when first
+ (form-set-value! frm 'name first)
+ (form-set-value! frm 'home
+ (string-append
"/home/"
+
first))))
+ ((eq? (field-symbol f) 'name)
+ (form-set-value! frm 'home
+ (string-append
+ "/home/"
+ (form-get-value
+ frm 'name))))))))))
(page-set-datum! p 'navigation nav)
(let ((acc (page-datum p 'account)))
- 157/197: installer: Replace 'file-browser' with 'key-map'., (continued)
- 157/197: installer: Replace 'file-browser' with 'key-map'., Danny Milosavljevic, 2017/07/03
- 161/197: installer: Improve i18n in ping page., Danny Milosavljevic, 2017/07/03
- 162/197: gurses: Avoid one use of car/cdr., Danny Milosavljevic, 2017/07/03
- 166/197: installer: Provide verbose description of locale., Danny Milosavljevic, 2017/07/03
- 167/197: installer: Fix bug when changing languages., Danny Milosavljevic, 2017/07/03
- 156/197: installer: New page to select language., Danny Milosavljevic, 2017/07/03
- 168/197: installer: Fix the startup locale., Danny Milosavljevic, 2017/07/03
- 173/197: installer: Remove whitespace., Danny Milosavljevic, 2017/07/03
- 01/197: gnu: Add graphical installer, Danny Milosavljevic, 2017/07/03
- 174/197: installer: Provide the ability to add new users., Danny Milosavljevic, 2017/07/03
- 178/197: installer: Infer likely entries for user accounts from the gecos field.,
Danny Milosavljevic <=
- 180/197: installer: Use a different mount-point for each install attempt., Danny Milosavljevic, 2017/07/03
- 183/197: installer: Specify a pid file for wpa_supplicant., Danny Milosavljevic, 2017/07/03
- 181/197: installer: Make the install attempts counter global., Danny Milosavljevic, 2017/07/03
- 186/197: installer: Return to network page after passphrase entry., Danny Milosavljevic, 2017/07/03
- 185/197: installer: Avoid flicker in network page., Danny Milosavljevic, 2017/07/03
- 169/197: installer: Add users page., Danny Milosavljevic, 2017/07/03
- 193/197: install: %installation-services: Make mingetty-service autologin to the installer., Danny Milosavljevic, 2017/07/03
- 196/197: installer: Add imports., Danny Milosavljevic, 2017/07/03
- 195/197: installer: Emit (gnu bootloader grub) import., Danny Milosavljevic, 2017/07/03
- 191/197: gurses: form: Handle Ctrl-F and Ctrl-B in forms., Danny Milosavljevic, 2017/07/03