summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-08-01 13:54:40 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-09-07 13:09:58 -0400
commit4949ada9da470b266063ff490438c85541af24cc (patch)
treefbc54ac309cb44e20b20a7528a42583cdc43758a /gnu/build
parent468e56576c23c44b96f0af08e15bd302862f9c81 (diff)
downloadpatches-4949ada9da470b266063ff490438c85541af24cc.tar
patches-4949ada9da470b266063ff490438c85541af24cc.tar.gz
build: container: Setup /dev/console.
* gnu/build/linux-container.scm (mount-file-systems): Bind mount the controlling terminal as /dev/console.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-container.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index af599040a1..c004303f03 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -55,6 +55,9 @@ to ROOT, then make ROOT the new root directory for the process."
(define (scope dir)
(string-append root dir))
+ (define (touch file-name)
+ (call-with-output-file file-name (const #t)))
+
(define (bind-mount src dest)
(mount src dest "none" MS_BIND))
@@ -89,8 +92,7 @@ to ROOT, then make ROOT the new root directory for the process."
(for-each (lambda (device)
(when (file-exists? device)
;; Create the mount point file.
- (call-with-output-file (scope device)
- (const #t))
+ (touch (scope device))
(bind-mount device (scope device))))
'("/dev/null"
"/dev/zero"
@@ -101,6 +103,15 @@ to ROOT, then make ROOT the new root directory for the process."
"/dev/ptmx"
"/dev/fuse"))
+ ;; Setup the container's /dev/console by bind mounting the pseudo-terminal
+ ;; associated with standard input.
+ (let ((in (current-input-port))
+ (console (scope "/dev/console")))
+ (when (isatty? in)
+ (touch console)
+ (chmod console #o600)
+ (bind-mount (ttyname in) console)))
+
;; Setup standard input/output/error.
(symlink "/proc/self/fd" (scope "/dev/fd"))
(symlink "/proc/self/fd/0" (scope "/dev/stdin"))