From 5970e8e248f6327c41c83b86bb2c89be7c3b1b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 10 Nov 2016 17:45:54 +0100 Subject: container: Pass a list of objects as things to mount. * gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a list of objects instead of a list of lists ("specs"). Add call to 'file-system->spec' as the argument to 'mount-file-system'. (run-container, call-with-container): Adjust docstring accordingly. * gnu/system/file-systems.scm (spec->file-system): New procedure. * gnu/system/linux-container.scm (container-script)[script]: Call 'spec->file-system' inside gexp. * guix/scripts/environment.scm (launch-environment/container): Remove call to 'file-system->spec'. * tests/containers.scm ("call-with-container, mnt namespace") ("call-with-container, mnt namespace, wrong bind mount"): Pass a list of objects. --- gnu/system/file-systems.scm | 11 +++++++++++ gnu/system/linux-container.scm | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index b51d57f079..4cc1221eb8 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -40,6 +40,7 @@ file-system-dependencies file-system->spec + spec->file-system specification->file-system-mapping uuid @@ -107,6 +108,16 @@ initrd code." (($ device title mount-point type flags options _ _ check?) (list device title mount-point type flags options check?)))) +(define (spec->file-system sexp) + "Deserialize SEXP, a list, to the corresponding object." + (match sexp + ((device title mount-point type flags options check?) + (file-system + (device device) (title title) + (mount-point mount-point) (type type) + (flags flags) (options options) + (check? check?))))) + (define (specification->file-system-mapping spec writable?) "Read the SPEC and return the corresponding . SPEC is a string of the form \"SOURCE\" or \"SOURCE=TARGET\". The former specifies diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 189f9efa79..24e61c3ead 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -94,9 +94,10 @@ that will be shared with the host system." (gnu build linux-container))) #~(begin (use-modules (gnu build linux-container) + (gnu system file-systems) ;spec->file-system (guix build utils)) - (call-with-container '#$specs + (call-with-container (map spec->file-system '#$specs) (lambda () (setenv "HOME" "/root") (setenv "TMPDIR" "/tmp") -- cgit v1.2.3