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
1 changed files with 34 additions and 3 deletions

View File

@ -193,9 +193,31 @@ stopped before 'kill' is called."
(define* (mingetty-service tty (define* (mingetty-service tty
#:key #:key
(motd (text-file "motd" "Welcome.\n")) (motd (text-file "motd" "Welcome.\n"))
auto-login
login-program
login-pause?
(allow-empty-passwords? #t)) (allow-empty-passwords? #t))
"Return a service to run mingetty on TTY." "Return a service to run mingetty on @var{tty}.
(mlet %store-monad ((motd motd))
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 (return
(service (service
(documentation (string-append "Run mingetty on " tty ".")) (documentation (string-append "Run mingetty on " tty "."))
@ -207,7 +229,16 @@ stopped before 'kill' is called."
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(string-append #$mingetty "/sbin/mingetty") (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)) (stop #~(make-kill-destructor))
(pam-services (pam-services