From db999667245926569b161747eed7e08b2ec1c34c 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 0000000000..0c363f4ac3 --- /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 a9c62e5534..f34c0970e6 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 7b788f9cbf..fa167fd78e 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 e93b4787a3..cc1673c8c6 100644 --- a/sysinit.go +++ b/sysinit/sysinit.go @@ -1,4 +1,4 @@ -package docker +package sysinit import ( "flag"