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.
This commit is contained in:
Ludovic Courtès 2014-05-31 19:16:50 +02:00
parent 1bb784ea05
commit 52322163ac

View file

@ -193,9 +193,31 @@ (define (host-name-service name)
(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 @@ (define* (mingetty-service tty
(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