summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/installer/final.scm1
-rw-r--r--gnu/installer/newt/user.scm38
2 files changed, 28 insertions, 11 deletions
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm
index c41670c197..855b640030 100644
--- a/gnu/installer/final.scm
+++ b/gnu/installer/final.scm
@@ -71,6 +71,7 @@ USERS."
              (string=? "root" (user-name user)))
 
            (sys:user-account (name (user-name user))
+                             (comment (user-real-name user))
                              (group "users")
                              (uid (if root? 0 #f))
                              (home-directory
diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm
index 617d2d0bca..7c646c1ae8 100644
--- a/gnu/installer/newt/user.scm
+++ b/gnu/installer/newt/user.scm
@@ -29,14 +29,17 @@
   #:use-module (srfi srfi-26)
   #:export (run-user-page))
 
-(define* (run-user-add-page #:key (name "") (home-directory ""))
-  "Run a form to enter the user name, home directory, and password.  Use NAME
-and HOME-DIRECTORY as the initial values in the form."
+(define* (run-user-add-page #:key (name "") (real-name "")
+                            (home-directory ""))
+  "Run a form to enter the user name, home directory, and password.  Use NAME,
+REAL-NAME, and HOME-DIRECTORY as the initial values in the form."
   (define (pad-label label)
     (string-pad-right label 20))
 
   (let* ((label-name
           (make-label -1 -1 (pad-label (G_ "Name"))))
+         (label-real-name
+          (make-label -1 -1 (pad-label (G_ "Real name"))))
          (label-home-directory
           (make-label -1 -1 (pad-label (G_ "Home directory"))))
          (label-password
@@ -44,11 +47,13 @@ and HOME-DIRECTORY as the initial values in the form."
          (entry-width 30)
          (entry-name (make-entry -1 -1 entry-width
                                  #:initial-value name))
+         (entry-real-name (make-entry -1 -1 entry-width
+                                      #:initial-value real-name))
          (entry-home-directory (make-entry -1 -1 entry-width
                                            #:initial-value home-directory))
          (entry-password (make-entry -1 -1 entry-width
                                      #:flags FLAG-PASSWORD))
-         (entry-grid (make-grid 3 4))
+         (entry-grid (make-grid 2 5))
          (button-grid (make-grid 1 1))
          (ok-button (make-button -1 -1 (G_ "OK")))
          (grid (make-grid 1 2))
@@ -59,10 +64,12 @@ and HOME-DIRECTORY as the initial values in the form."
 
     (set-entry-grid-field 0 0 label-name)
     (set-entry-grid-field 1 0 entry-name)
-    (set-entry-grid-field 0 1 label-home-directory)
-    (set-entry-grid-field 1 1 entry-home-directory)
-    (set-entry-grid-field 0 2 label-password)
-    (set-entry-grid-field 1 2 entry-password)
+    (set-entry-grid-field 0 1 label-real-name)
+    (set-entry-grid-field 1 1 entry-real-name)
+    (set-entry-grid-field 0 2 label-home-directory)
+    (set-entry-grid-field 1 2 entry-home-directory)
+    (set-entry-grid-field 0 3 label-password)
+    (set-entry-grid-field 1 3 entry-password)
 
     (set-grid-field button-grid 0 0 GRID-ELEMENT-COMPONENT ok-button)
 
@@ -70,11 +77,17 @@ and HOME-DIRECTORY as the initial values in the form."
      entry-name
      (lambda (component)
        (set-entry-text entry-home-directory
-                       (string-append "/home/" (entry-value entry-name)))))
+                       (string-append "/home/" (entry-value entry-name)))
+
+       (when (string-null? (entry-value entry-real-name))
+         (set-entry-text entry-real-name
+                         (string-titlecase (entry-value entry-name))))))
 
     (add-components-to-form form
-                            label-name label-home-directory label-password
-                            entry-name entry-home-directory entry-password
+                            label-name label-real-name
+                            label-home-directory label-password
+                            entry-name entry-real-name
+                            entry-home-directory entry-password
                             ok-button)
 
     (make-wrapped-grid-window (vertically-stacked-grid
@@ -94,6 +107,7 @@ and HOME-DIRECTORY as the initial values in the form."
               (cond
                ((components=? argument ok-button)
                 (let ((name           (entry-value entry-name))
+                      (real-name      (entry-value entry-real-name))
                       (home-directory (entry-value entry-home-directory))
                       (password       (entry-value entry-password)))
                   (if (or (string=? name "")
@@ -103,12 +117,14 @@ and HOME-DIRECTORY as the initial values in the form."
                         (run-user-add-page))
                       (user
                        (name name)
+                       (real-name real-name)
                        (home-directory home-directory)
                        (password
                         (confirm-password password
                                           (lambda ()
                                             (run-user-add-page
                                              #:name name
+                                             #:real-name real-name
                                              #:home-directory
                                              home-directory)))))))))))
           (lambda ()