guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30355] [PATCH] services: agetty: Make tty optional and add agetty i


From: Danny Milosavljevic
Subject: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services.
Date: Fri, 9 Feb 2018 20:49:12 +0100

> Please make that a single ‘filter’ or ‘remove’ call, for clarity.

OK!

> Rather:
> 
>   (match (append agetty-specs console-specs)
>     (() #f)
>     ((spec _ ...)
>      (string-tokenize spec not-comma)))

Crashes boot process with form error ().

I can't get "match" to work at all in this location.

It works fine when I start guile on a normally running system, but
in this initrd guile thing, (use-modules (ice-9 match)) doesn't help
either.  What does help is (@ (ice-9 match) match).  Why?

(define (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."
  #~(begin
      ;; console=device,options
      ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial).
      ;; options: BBBBPNF. P n|o|e, N number of bits,
      ;; F flow control (r RTS)
      (use-modules (gnu build linux-boot))
      (let* ((not-comma (char-set-complement (char-set #\,)))
             (command (linux-command-line))
             (agetty-specs (find-long-options "agetty.tty" command))
             (console-specs (filter (lambda (spec)
                                     (and (string-prefix? "tty" spec)
                                          (not (or
                                                (string-prefix? "tty0" spec)
                                                (string-prefix? "tty1" spec)
                                                (string-prefix? "tty2" spec)
                                                (string-prefix? "tty3" spec)
                                                (string-prefix? "tty4" spec)
                                                (string-prefix? "tty5" spec)
                                                (string-prefix? "tty6" spec)
                                                (string-prefix? "tty7" spec)
                                                (string-prefix? "tty8" spec)
                                                (string-prefix? "tty9" spec)))))
                                    (find-long-options "console" command)))
             (specs (append agetty-specs console-specs)))
        (use-modules (ice-9 match))
        (match specs
         (() #f) ;        form error here
         ((spec _ ...) ; underscore is undefined
          ;; Extract device name from first spec.
          (match (string-tokenize spec not-comma)
           ((device-name _ ...) ; underscore is undefined
            device-name)))))))

Works just fine if I execute it in a running system, mind you...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]