services: agetty: Explicitly depend on (gnu build linux-boot).

* gnu/services/base.scm (default-serial-port): Wrap in
'with-imported-modules'.
This commit is contained in:
Ludovic Courtès 2019-10-06 12:01:24 +02:00
parent 1994422752
commit 62c2217570
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 32 additions and 30 deletions

View File

@ -939,36 +939,38 @@ the message of the day, among other things."
(define (default-serial-port) (define (default-serial-port)
"Return a gexp that determines a reasonable default serial port "Return a gexp that determines a reasonable default serial port
to use as the tty. This is primarily useful for headless systems." to use as the tty. This is primarily useful for headless systems."
#~(begin (with-imported-modules (source-module-closure
;; console=device,options '((gnu build linux-boot))) ;for 'find-long-options'
;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial). #~(begin
;; options: BBBBPNF. P n|o|e, N number of bits, ;; console=device,options
;; F flow control (r RTS) ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial).
(let* ((not-comma (char-set-complement (char-set #\,))) ;; options: BBBBPNF. P n|o|e, N number of bits,
(command (linux-command-line)) ;; F flow control (r RTS)
(agetty-specs (find-long-options "agetty.tty" command)) (let* ((not-comma (char-set-complement (char-set #\,)))
(console-specs (filter (lambda (spec) (command (linux-command-line))
(and (string-prefix? "tty" spec) (agetty-specs (find-long-options "agetty.tty" command))
(not (or (console-specs (filter (lambda (spec)
(string-prefix? "tty0" spec) (and (string-prefix? "tty" spec)
(string-prefix? "tty1" spec) (not (or
(string-prefix? "tty2" spec) (string-prefix? "tty0" spec)
(string-prefix? "tty3" spec) (string-prefix? "tty1" spec)
(string-prefix? "tty4" spec) (string-prefix? "tty2" spec)
(string-prefix? "tty5" spec) (string-prefix? "tty3" spec)
(string-prefix? "tty6" spec) (string-prefix? "tty4" spec)
(string-prefix? "tty7" spec) (string-prefix? "tty5" spec)
(string-prefix? "tty8" spec) (string-prefix? "tty6" spec)
(string-prefix? "tty9" spec))))) (string-prefix? "tty7" spec)
(find-long-options "console" command))) (string-prefix? "tty8" spec)
(specs (append agetty-specs console-specs))) (string-prefix? "tty9" spec)))))
(match specs (find-long-options "console" command)))
(() #f) (specs (append agetty-specs console-specs)))
((spec _ ...) (match specs
;; Extract device name from first spec. (() #f)
(match (string-tokenize spec not-comma) ((spec _ ...)
((device-name _ ...) ;; Extract device name from first spec.
device-name))))))) (match (string-tokenize spec not-comma)
((device-name _ ...)
device-name))))))))
(define agetty-shepherd-service (define agetty-shepherd-service
(match-lambda (match-lambda