summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-12-07 18:26:11 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-12-07 18:26:11 +0100
commit9e111db4535b3cd5729e37294ae51d95240334b4 (patch)
treecc90a9de80ff39bd93426b763918d904abfeeb56 /gnu/services
parent92b61d3e1bb50f0c1d087bc8d57cc00c3ce360df (diff)
parentcf69135d5e6797e566b8bb18419ae9e3c8aeb621 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm56
-rw-r--r--gnu/services/ssh.scm12
2 files changed, 48 insertions, 20 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 11f55c588c..291dd63256 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -621,21 +621,23 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
(define (unicode-start tty)
"Return a gexp to start Unicode support on @var{tty}."
-
- ;; We have to run 'unicode_start' in a pipe so that when it invokes the
- ;; 'tty' command, that command returns TTY.
- #~(begin
- (let ((pid (primitive-fork)))
- (case pid
- ((0)
- (close-fdes 0)
- (dup2 (open-fdes #$tty O_RDONLY) 0)
- (close-fdes 1)
- (dup2 (open-fdes #$tty O_WRONLY) 1)
- (execl #$(file-append kbd "/bin/unicode_start")
- "unicode_start"))
- (else
- (zero? (cdr (waitpid pid))))))))
+ (with-imported-modules '((guix build syscalls))
+ #~(let* ((fd (open-fdes #$tty O_RDWR))
+ (termios (tcgetattr fd)))
+ (define (set-utf8-input termios)
+ (set-field termios (termios-input-flags)
+ (logior (input-flags IUTF8)
+ (termios-input-flags termios))))
+
+ ;; See console_codes(4).
+ (display "\x1b%G" (fdes->outport fd))
+
+ (tcsetattr fd (tcsetattr-action TCSAFLUSH)
+ (set-utf8-input termios))
+
+ ;; TODO: ioctl(fd, KDSKBMODE, K_UNICODE);
+ (close-fdes fd)
+ #t)))
(define console-keymap-service-type
(shepherd-service-type
@@ -674,11 +676,29 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
(requirement (list (symbol-append 'term-
(string->symbol tty))))
+ (modules '((guix build syscalls) ;for 'tcsetattr'
+ (srfi srfi-9 gnu))) ;for 'set-field'
(start #~(lambda _
+ ;; It could be that mingetty is not fully ready yet,
+ ;; which we check by calling 'ttyname'.
+ (let loop ((i 10))
+ (unless (or (zero? i)
+ (call-with-input-file #$device
+ (lambda (port)
+ (false-if-exception (ttyname port)))))
+ (usleep 500)
+ (loop (- i 1))))
+
(and #$(unicode-start device)
- (zero?
- (system* #$(file-append kbd "/bin/setfont")
- "-C" #$device #$font)))))
+ ;; 'setfont' returns EX_OSERR (71) when an
+ ;; KDFONTOP ioctl fails, for example. Like
+ ;; systemd's vconsole support, let's not treat
+ ;; this as an error.
+ (case (status:exit-val
+ (system* #$(file-append kbd "/bin/setfont")
+ "-C" #$device #$font))
+ ((0 71) #t)
+ (else #f)))))
(stop #~(const #t))
(respawn? #f)))))
tty+font))
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index b33ec946c6..301ba74041 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -304,7 +304,14 @@ The other options should be self-descriptive."
;; list of user-name/file-like tuples
(authorized-keys openssh-authorized-keys
- (default '())))
+ (default '()))
+
+ ;; Boolean
+ ;; XXX: This should really be handled in an orthogonal way, for instance as
+ ;; proposed in <https://bugs.gnu.org/27155>. Keep it internal/undocumented
+ ;; for now.
+ (%auto-start? openssh-auto-start?
+ (default #t)))
(define %openssh-accounts
(list (user-group (name "sshd") (system? #t))
@@ -445,7 +452,8 @@ of user-name/file-like tuples."
(provision '(ssh-daemon))
(start #~(make-forkexec-constructor #$openssh-command
#:pid-file #$pid-file))
- (stop #~(make-kill-destructor)))))
+ (stop #~(make-kill-destructor))
+ (auto-start? (openssh-auto-start? config)))))
(define (openssh-pam-services config)
"Return a list of <pam-services> for sshd with CONFIG."