summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-31 19:16:50 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-31 21:51:04 +0200
commit52322163ac4b730a62af67549583d89ee496aeff (patch)
tree708f8d77ecbd5326d18a484db4f484dbced47270
parent1bb784ea05b2eeac13f7355ae2f51fbd302a36b7 (diff)
downloadguix-52322163ac4b730a62af67549583d89ee496aeff.tar.gz
system: Add more options for 'mingetty-service'.
* gnu/services/base.scm (mingetty-service): Add #:auto-login,
  #:login-program, and #:login-pause? parameters and honor them.
-rw-r--r--gnu/services/base.scm37
1 files changed, 34 insertions, 3 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index dc0161408b..102363819c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -193,9 +193,31 @@ stopped before 'kill' is called."
 (define* (mingetty-service tty
                            #:key
                            (motd (text-file "motd" "Welcome.\n"))
+                           auto-login
+                           login-program
+                           login-pause?
                            (allow-empty-passwords? #t))
-  "Return a service to run mingetty on TTY."
-  (mlet %store-monad ((motd motd))
+  "Return a service to run mingetty on @var{tty}.
+
+When @var{allow-empty-passwords?} is true, allow empty log-in password.  When
+@var{auto-login} is true, it must be a user name under which to log-in
+automatically.  @var{login-pause?} can be set to @code{#t} in conjunction with
+@var{auto-login}, in which case the user will have to press a key before the
+login shell is launched.
+
+When true, @var{login-program} is a gexp or a monadic gexp denoting the name
+of the log-in program (the default is the @code{login} program from the Shadow
+tool suite.)
+
+@var{motd} is a monadic value containing a text file to use as
+the \"message of the day\"."
+  (mlet %store-monad ((motd motd)
+                      (login-program (cond ((gexp? login-program)
+                                            (return login-program))
+                                           ((not login-program)
+                                            (return #f))
+                                           (else
+                                            login-program))))
     (return
      (service
       (documentation (string-append "Run mingetty on " tty "."))
@@ -207,7 +229,16 @@ stopped before 'kill' is called."
 
       (start  #~(make-forkexec-constructor
                  (string-append #$mingetty "/sbin/mingetty")
-                 "--noclear" #$tty))
+                 "--noclear" #$tty
+                 #$@(if auto-login
+                        #~("--autologin" #$auto-login)
+                        #~())
+                 #$@(if login-program
+                        #~("--loginprog" #$login-program)
+                        #~())
+                 #$@(if login-pause?
+                        #~("--loginpause")
+                        #~())))
       (stop   #~(make-kill-destructor))
 
       (pam-services