services: agetty: Call default-serial-port only when starting.

* gnu/services/base.scm (agetty-shepherd-service): Call default-serial-port
only when starting.
This commit is contained in:
Danny Milosavljevic 2018-03-08 09:50:07 +01:00
parent 770986d541
commit c32e3ddedd
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5

View File

@ -937,119 +937,122 @@ to use as the tty. This is primarily useful for headless systems."
;; mingetty-shepherd-service). ;; mingetty-shepherd-service).
(requirement '(user-processes host-name udev)) (requirement '(user-processes host-name udev))
(start #~(let ((tty #$(default-serial-port))) (start #~(lambda args
(if tty (let ((defaulted-tty #$(or tty (default-serial-port))))
(make-forkexec-constructor (apply
(list #$(file-append util-linux "/sbin/agetty") (if defaulted-tty
#$@extra-options (make-forkexec-constructor
#$@(if eight-bits? (list #$(file-append util-linux "/sbin/agetty")
#~("--8bits") #$@extra-options
#~()) #$@(if eight-bits?
#$@(if no-reset? #~("--8bits")
#~("--noreset") #~())
#~()) #$@(if no-reset?
#$@(if remote? #~("--noreset")
#~("--remote") #~())
#~()) #$@(if remote?
#$@(if flow-control? #~("--remote")
#~("--flow-control") #~())
#~()) #$@(if flow-control?
#$@(if host #~("--flow-control")
#~("--host" #$host) #~())
#~()) #$@(if host
#$@(if no-issue? #~("--host" #$host)
#~("--noissue") #~())
#~()) #$@(if no-issue?
#$@(if init-string #~("--noissue")
#~("--init-string" #$init-string) #~())
#~()) #$@(if init-string
#$@(if no-clear? #~("--init-string" #$init-string)
#~("--noclear") #~())
#~()) #$@(if no-clear?
#~("--noclear")
#~())
;;; FIXME This doesn't work as expected. According to agetty(8), if this option ;;; FIXME This doesn't work as expected. According to agetty(8), if this option
;;; is not passed, then the default is 'auto'. However, in my tests, when that ;;; is not passed, then the default is 'auto'. However, in my tests, when that
;;; option is selected, agetty never presents the login prompt, and the ;;; option is selected, agetty never presents the login prompt, and the
;;; term-ttyS0 service respawns every few seconds. ;;; term-ttyS0 service respawns every few seconds.
#$@(if local-line #$@(if local-line
#~(#$(match local-line #~(#$(match local-line
('auto "--local-line=auto") ('auto "--local-line=auto")
('always "--local-line=always") ('always "--local-line=always")
('never "-local-line=never"))) ('never "-local-line=never")))
#~()) #~())
#$@(if tty #$@(if tty
#~() #~()
#~("--keep-baud")) #~("--keep-baud"))
#$@(if extract-baud? #$@(if extract-baud?
#~("--extract-baud") #~("--extract-baud")
#~()) #~())
#$@(if skip-login? #$@(if skip-login?
#~("--skip-login") #~("--skip-login")
#~()) #~())
#$@(if no-newline? #$@(if no-newline?
#~("--nonewline") #~("--nonewline")
#~()) #~())
#$@(if login-options #$@(if login-options
#~("--login-options" #$login-options) #~("--login-options" #$login-options)
#~()) #~())
#$@(if chroot #$@(if chroot
#~("--chroot" #$chroot) #~("--chroot" #$chroot)
#~()) #~())
#$@(if hangup? #$@(if hangup?
#~("--hangup") #~("--hangup")
#~()) #~())
#$@(if keep-baud? #$@(if keep-baud?
#~("--keep-baud") #~("--keep-baud")
#~()) #~())
#$@(if timeout #$@(if timeout
#~("--timeout" #$(number->string timeout)) #~("--timeout" #$(number->string timeout))
#~()) #~())
#$@(if detect-case? #$@(if detect-case?
#~("--detect-case") #~("--detect-case")
#~()) #~())
#$@(if wait-cr? #$@(if wait-cr?
#~("--wait-cr") #~("--wait-cr")
#~()) #~())
#$@(if no-hints? #$@(if no-hints?
#~("--nohints?") #~("--nohints?")
#~()) #~())
#$@(if no-hostname? #$@(if no-hostname?
#~("--nohostname") #~("--nohostname")
#~()) #~())
#$@(if long-hostname? #$@(if long-hostname?
#~("--long-hostname") #~("--long-hostname")
#~()) #~())
#$@(if erase-characters #$@(if erase-characters
#~("--erase-chars" #$erase-characters) #~("--erase-chars" #$erase-characters)
#~()) #~())
#$@(if kill-characters #$@(if kill-characters
#~("--kill-chars" #$kill-characters) #~("--kill-chars" #$kill-characters)
#~()) #~())
#$@(if chdir #$@(if chdir
#~("--chdir" #$chdir) #~("--chdir" #$chdir)
#~()) #~())
#$@(if delay #$@(if delay
#~("--delay" #$(number->string delay)) #~("--delay" #$(number->string delay))
#~()) #~())
#$@(if nice #$@(if nice
#~("--nice" #$(number->string nice)) #~("--nice" #$(number->string nice))
#~()) #~())
#$@(if auto-login #$@(if auto-login
(list "--autologin" auto-login) (list "--autologin" auto-login)
'()) '())
#$@(if login-program #$@(if login-program
#~("--login-program" #$login-program) #~("--login-program" #$login-program)
#~()) #~())
#$@(if login-pause? #$@(if login-pause?
#~("--login-pause") #~("--login-pause")
#~()) #~())
#$(or tty (default-serial-port)) defaulted-tty
#$@(if baud-rate #$@(if baud-rate
#~(#$baud-rate) #~(#$baud-rate)
#~()) #~())
#$@(if term #$@(if term
#~(#$term) #~(#$term)
#~())))) #~())))
(const #f))) ; never start. (const #f)) ; never start.
args))))
(stop #~(make-kill-destructor))))))) (stop #~(make-kill-destructor)))))))
(define agetty-service-type (define agetty-service-type