[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/13: gnu: Add Linux container system script.
From: |
David Thompson |
Subject: |
09/13: gnu: Add Linux container system script. |
Date: |
Fri, 26 Jun 2015 00:27:35 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit 65bb3738daa44b5cd011dd8e670bfaab0da6d913
Author: David Thompson <address@hidden>
Date: Mon Jun 8 08:59:00 2015 -0400
gnu: Add Linux container system script.
* gnu/system/linux-container.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
gnu-system.am | 1 +
gnu/system/linux-container.scm | 50 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/gnu-system.am b/gnu-system.am
index 3bb8982..286abfa 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -346,6 +346,7 @@ GNU_SYSTEM_MODULES = \
gnu/system/grub.scm \
gnu/system/install.scm \
gnu/system/linux.scm \
+ gnu/system/linux-container.scm \
gnu/system/linux-initrd.scm \
gnu/system/locale.scm \
gnu/system/nss.scm \
diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
new file mode 100644
index 0000000..bab27cf
--- /dev/null
+++ b/gnu/system/linux-container.scm
@@ -0,0 +1,50 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 David Thompson <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu system linux-container)
+ #:use-module (guix config)
+ #:use-module (guix store)
+ #:use-module (guix gexp)
+ #:use-module (guix derivations)
+ #:use-module (guix monads)
+ #:use-module (gnu build linux-container)
+ #:use-module (gnu system)
+ #:use-module (gnu services)
+ #:export (linux-container-script))
+
+(define (linux-container-script os)
+ (mlet* %store-monad
+ ((os-drv (operating-system-derivation/container os)))
+
+ (define script
+ #~(begin
+ (use-modules (guix build utils)
+ (gnu build linux-container))
+
+ ;; Bind-mount the store.
+ (call-with-container '((#$(%store-prefix) #$(%store-prefix)))
+ (lambda ()
+ (for-each mkdir '("/run" "/bin" "/etc" "/home"))
+ (primitive-load (string-append #$os-drv "/boot"))))))
+
+ (gexp->script "run-container" script
+ #:modules '((guix config)
+ (guix utils)
+ (guix build utils)
+ (guix build syscalls)
+ (gnu build linux-container)))))
- branch wip-container created (now bfd304b), David Thompson, 2015/06/25
- 01/13: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/06/25
- 04/13: build: syscalls: Add unmount flags., David Thompson, 2015/06/25
- 02/13: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/06/25
- 03/13: build: syscalls: Add additional mount flags., David Thompson, 2015/06/25
- 05/13: build: syscalls: Add mkdtemp!, David Thompson, 2015/06/25
- 06/13: build: syscalls: Add pivot-root., David Thompson, 2015/06/25
- 07/13: utils: Add call-with-temporary-directory., David Thompson, 2015/06/25
- 09/13: gnu: Add Linux container system script.,
David Thompson <=
- 10/13: gnu: system: Do not activate firmware when activating a container., David Thompson, 2015/06/25
- 08/13: gnu: Add Linux container module., David Thompson, 2015/06/25
- 11/13: gnu: system: Add operating-system-derivation/container., David Thompson, 2015/06/25
- 12/13: scripts: system: Add 'container' subcommand., David Thompson, 2015/06/25
- 13/13: scripts: environment: Add --container option., David Thompson, 2015/06/25