[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/08: services: virtual-terminal: Write to "default_utf8" only if neces
From: |
Ludovic Courtès |
Subject: |
07/08: services: virtual-terminal: Write to "default_utf8" only if necessary. |
Date: |
Wed, 26 Sep 2018 17:40:47 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 09b7300c01a8e7100467c6caae9b2c8d8e673971
Author: Ludovic Courtès <address@hidden>
Date: Wed Sep 26 23:01:33 2018 +0200
services: virtual-terminal: Write to "default_utf8" only if necessary.
Fixes a bug in containers whereby 'virtual-terminal' would always fail
to start because writing to /sys/…/default_utf8 would fail with EROFS.
* gnu/services/base.scm (virtual-terminal-service-type): Read from
"default_utf8" before attempting to write to it.
---
gnu/services/base.scm | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 9dfabd9..47c7d8b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -685,17 +685,20 @@ to add @var{device} to the kernel's entropy pool. The
service will fail if
(shepherd-service-type
'virtual-terminal
(lambda (utf8?)
- (shepherd-service
- (documentation "Set virtual terminals in UTF-8 module.")
- (provision '(virtual-terminal))
- (requirement '(root-file-system))
- (start #~(lambda _
- (call-with-output-file
- "/sys/module/vt/parameters/default_utf8"
- (lambda (port)
- (display 1 port)))
- #t))
- (stop #~(const #f))))
+ (let ((knob "/sys/module/vt/parameters/default_utf8"))
+ (shepherd-service
+ (documentation "Set virtual terminals in UTF-8 module.")
+ (provision '(virtual-terminal))
+ (requirement '(root-file-system))
+ (start #~(lambda _
+ ;; In containers /sys is read-only so don't insist on
+ ;; writing to this file.
+ (unless (= 1 (call-with-input-file #$knob read))
+ (call-with-output-file #$knob
+ (lambda (port)
+ (display 1 port))))
+ #t))
+ (stop #~(const #f)))))
#t)) ;default to UTF-8
(define console-keymap-service-type
- branch master updated (0661912 -> e15ede6), Ludovic Courtès, 2018/09/26
- 01/08: gnu: shepherd: Update to 0.5.0., Ludovic Courtès, 2018/09/26
- 04/08: services: dhcp-client: Use 'read-pid-file'., Ludovic Courtès, 2018/09/26
- 06/08: services: udev: Don't attempt to read "modules.devname" from a container., Ludovic Courtès, 2018/09/26
- 02/08: guix system: Load all services on reconfigure, not just stopped ones., Ludovic Courtès, 2018/09/26
- 08/08: gnu: enlightenment: Fix initial locale and keyboard selection., Ludovic Courtès, 2018/09/26
- 03/08: gnu: Remove incorrect Emacs package deprecations., Ludovic Courtès, 2018/09/26
- 05/08: services: shepherd: Add workaround for 0.5.0 in containers., Ludovic Courtès, 2018/09/26
- 07/08: services: virtual-terminal: Write to "default_utf8" only if necessary.,
Ludovic Courtès <=