From e6e6d89cc18990387f076e5f31ec28c75ef5e494 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 10 Oct 2013 10:53:38 +0200 Subject: [PATCH] Move SysInit to a submodule This allows docker-init to not import the main docker module, which means it won't e.g. pick up any sqlite dependencies. --- docker-init/docker-init.go | 16 ++++++++++++++++ docker/docker.go | 3 ++- runtime_test.go | 3 ++- sysinit.go => sysinit/sysinit.go | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 docker-init/docker-init.go rename sysinit.go => sysinit/sysinit.go (99%) diff --git a/docker-init/docker-init.go b/docker-init/docker-init.go new file mode 100644 index 000000000..0c363f4ac --- /dev/null +++ b/docker-init/docker-init.go @@ -0,0 +1,16 @@ +package main + +import ( + "github.com/dotcloud/docker/sysinit" +) + +var ( + GITCOMMIT string + VERSION string +) + +func main() { + // Running in init mode + sysinit.SysInit() + return +} diff --git a/docker/docker.go b/docker/docker.go index 569177d5b..971f83486 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "github.com/dotcloud/docker" + "github.com/dotcloud/docker/sysinit" "github.com/dotcloud/docker/utils" "io/ioutil" "log" @@ -23,7 +24,7 @@ var ( func main() { if selfPath := utils.SelfPath(); selfPath == "/sbin/init" || selfPath == "/.dockerinit" { // Running in init mode - docker.SysInit() + sysinit.SysInit() return } // FIXME: Switch d and D ? (to be more sshd like) diff --git a/runtime_test.go b/runtime_test.go index 542c98926..8f73cec27 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -3,6 +3,7 @@ package docker import ( "bytes" "fmt" + "github.com/dotcloud/docker/sysinit" "github.com/dotcloud/docker/utils" "io" "log" @@ -77,7 +78,7 @@ func init() { // Hack to run sys init during unit testing if selfPath := utils.SelfPath(); selfPath == "/sbin/init" || selfPath == "/.dockerinit" { - SysInit() + sysinit.SysInit() return } diff --git a/sysinit.go b/sysinit/sysinit.go similarity index 99% rename from sysinit.go rename to sysinit/sysinit.go index 0643882e8..6b2591fd1 100644 --- a/sysinit.go +++ b/sysinit/sysinit.go @@ -1,4 +1,4 @@ -package docker +package sysinit import ( "flag"