diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-09-13 21:28:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-09-13 21:28:01 +0200 |
commit | 75710da66710cef1d32053cd8f350d13057d02a7 (patch) | |
tree | abef6a326c741b1eb18db866b2f2bacee3e5fc51 /gnu/build | |
parent | ab20c2cc33063ce783515d8ae7899ec7e2ca6f96 (diff) | |
parent | 610075f7c94c80b8321887b7ccf8bb1a7edd2b8e (diff) |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/linux-container.scm | 18 | ||||
-rw-r--r-- | gnu/build/linux-initrd.scm | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index af599040a1..95220d0bc0 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")) @@ -151,7 +162,8 @@ host user identifiers to map into the user namespace." (define (namespaces->bit-mask namespaces) "Return the number suitable for the 'flags' argument of 'clone' that corresponds to the symbols in NAMESPACES." - (apply logior SIGCHLD + ;; Use the same flags as fork(3) in addition to the namespace flags. + (apply logior SIGCHLD CLONE_CHILD_CLEARTID CLONE_CHILD_SETTID (map (match-lambda ('mnt CLONE_NEWNS) ('uts CLONE_NEWUTS) diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm index e26c067b49..c65b5aacfa 100644 --- a/gnu/build/linux-initrd.scm +++ b/gnu/build/linux-initrd.scm @@ -72,7 +72,9 @@ COMPRESS? is true, compress it using GZIP. On success, return OUTPUT." #:file->header cpio:file->cpio-header*))) (or (not compress?) - (and (zero? (system* gzip "--best" output)) + ;; Use '--no-name' so that gzip records neither a file name nor a time + ;; stamp in its output. + (and (zero? (system* gzip "--best" "--no-name" output)) (rename-file (string-append output ".gz") output)) output)) |