diff options
| -rw-r--r-- | gnu/build/linux-container.scm | 11 | ||||
| -rw-r--r-- | guix/scripts/environment.scm | 15 | ||||
| -rw-r--r-- | guix/scripts/home.scm | 10 |
3 files changed, 21 insertions, 15 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index 3e5158c2fd7..b6f8563f7d0 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | unprivileged-user-namespace-supported? | 30 | unprivileged-user-namespace-supported? |
| 31 | setgroups-supported? | 31 | setgroups-supported? |
| 32 | %namespaces | 32 | %namespaces |
| 33 | %writable-/tmp | ||
| 33 | run-container | 34 | run-container |
| 34 | call-with-container | 35 | call-with-container |
| 35 | container-excursion | 36 | container-excursion |
| @@ -387,6 +388,16 @@ if there are no child processes left." | |||
| 387 | (+ 128 (or (status:term-sig status) | 388 | (+ 128 (or (status:term-sig status) |
| 388 | (status:stop-sig status))))) | 389 | (status:stop-sig status))))) |
| 389 | 390 | ||
| 391 | (define %writable-/tmp | ||
| 392 | ;; Writable and volatile /tmp. | ||
| 393 | (file-system | ||
| 394 | (device "none") | ||
| 395 | (mount-point "/tmp") | ||
| 396 | (type "tmpfs") | ||
| 397 | (flags '(no-suid no-dev)) | ||
| 398 | (options "mode=755,size=10%") | ||
| 399 | (check? #f))) | ||
| 400 | |||
| 390 | (define* (call-with-container mounts thunk #:key (namespaces %namespaces) | 401 | (define* (call-with-container mounts thunk #:key (namespaces %namespaces) |
| 391 | (host-uids 1) (guest-uid 0) (guest-gid 0) | 402 | (host-uids 1) (guest-uid 0) (guest-gid 0) |
| 392 | (lock-mounts? #t) | 403 | (lock-mounts? #t) |
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 429a5a296f7..41353e33053 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #:autoload (ice-9 ftw) (scandir) | 40 | #:autoload (ice-9 ftw) (scandir) |
| 41 | #:autoload (gnu build install) (evaluate-populate-directive) | 41 | #:autoload (gnu build install) (evaluate-populate-directive) |
| 42 | #:autoload (gnu build linux-container) (call-with-container %namespaces | 42 | #:autoload (gnu build linux-container) (call-with-container %namespaces |
| 43 | %writable-/tmp | ||
| 43 | user-namespace-supported? | 44 | user-namespace-supported? |
| 44 | unprivileged-user-namespace-supported? | 45 | unprivileged-user-namespace-supported? |
| 45 | setgroups-supported?) | 46 | setgroups-supported?) |
| @@ -771,13 +772,6 @@ added to the container. | |||
| 771 | 772 | ||
| 772 | Preserve environment variables whose name matches the one of the regexps in | 773 | Preserve environment variables whose name matches the one of the regexps in |
| 773 | WHILE-LIST." | 774 | WHILE-LIST." |
| 774 | (define tmpfs | ||
| 775 | (file-system | ||
| 776 | (device "none") | ||
| 777 | (mount-point "/tmp") | ||
| 778 | (type "tmpfs") | ||
| 779 | (check? #f))) | ||
| 780 | |||
| 781 | (define (optional-mapping->fs mapping) | 775 | (define (optional-mapping->fs mapping) |
| 782 | (and (file-exists? (file-system-mapping-source mapping)) | 776 | (and (file-exists? (file-system-mapping-source mapping)) |
| 783 | (file-system-mapping->bind-mount mapping))) | 777 | (file-system-mapping->bind-mount mapping))) |
| @@ -875,9 +869,12 @@ WHILE-LIST." | |||
| 875 | (writable? #f))) | 869 | (writable? #f))) |
| 876 | reqs))) | 870 | reqs))) |
| 877 | (file-systems (append %container-file-systems | 871 | (file-systems (append %container-file-systems |
| 878 | (list tmpfs ; RW /tmp | 872 | (list %writable-/tmp |
| 879 | (file-system ; RW /run | 873 | (file-system ; RW /run |
| 880 | (inherit tmpfs) | 874 | (device "none") |
| 875 | (type "tmpfs") | ||
| 876 | (options "size=10%,mode=700") | ||
| 877 | (check? #f) | ||
| 881 | (mount-point | 878 | (mount-point |
| 882 | (string-append "/run/user/" | 879 | (string-append "/run/user/" |
| 883 | (number->string uid)))) | 880 | (number->string uid)))) |
diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index a4b8cc01e70..ae003816f92 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm | |||
| @@ -38,7 +38,9 @@ | |||
| 38 | group-entry | 38 | group-entry |
| 39 | write-passwd | 39 | write-passwd |
| 40 | write-group) | 40 | write-group) |
| 41 | #:autoload (gnu build linux-container) (call-with-container %namespaces) | 41 | #:autoload (gnu build linux-container) (call-with-container |
| 42 | %namespaces | ||
| 43 | %writable-/tmp) | ||
| 42 | #:use-module ((gnu system) #:select (operating-system? | 44 | #:use-module ((gnu system) #:select (operating-system? |
| 43 | operating-system-user-services)) | 45 | operating-system-user-services)) |
| 44 | #:autoload (gnu system linux-container) (eval/container) | 46 | #:autoload (gnu system linux-container) (eval/container) |
| @@ -353,11 +355,7 @@ immediately. Return the exit status of the process in the container." | |||
| 353 | #:namespaces (if network? | 355 | #:namespaces (if network? |
| 354 | (delq 'net %namespaces) ; share host network | 356 | (delq 'net %namespaces) ; share host network |
| 355 | %namespaces) | 357 | %namespaces) |
| 356 | #:mounts (list (file-system ;writable /tmp | 358 | #:mounts (list %writable-/tmp |
| 357 | (device "none") | ||
| 358 | (mount-point "/tmp") | ||
| 359 | (type "tmpfs") | ||
| 360 | (check? #f)) | ||
| 361 | (file-system | 359 | (file-system |
| 362 | (device "none") | 360 | (device "none") |
| 363 | (mount-point | 361 | (mount-point |
