Skip to content

Commit ab5d7ec

Browse files
alexlarssonvieux
authored andcommitted
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.
1 parent 0e42222 commit ab5d7ec

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

docker-init/docker-init.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"github.com/dotcloud/docker/sysinit"
5+
)
6+
7+
var (
8+
GITCOMMIT string
9+
VERSION string
10+
)
11+
12+
func main() {
13+
// Running in init mode
14+
sysinit.SysInit()
15+
return
16+
}

docker/docker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"flag"
55
"fmt"
66
"github.com/dotcloud/docker"
7+
"github.com/dotcloud/docker/sysinit"
78
"github.com/dotcloud/docker/utils"
89
"io/ioutil"
910
"log"
@@ -23,7 +24,7 @@ var (
2324
func main() {
2425
if selfPath := utils.SelfPath(); selfPath == "/sbin/init" || selfPath == "/.dockerinit" {
2526
// Running in init mode
26-
docker.SysInit()
27+
sysinit.SysInit()
2728
return
2829
}
2930
// FIXME: Switch d and D ? (to be more sshd like)

runtime_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package docker
33
import (
44
"bytes"
55
"fmt"
6+
"github.com/dotcloud/docker/sysinit"
67
"github.com/dotcloud/docker/utils"
78
"io"
89
"log"
@@ -77,7 +78,7 @@ func init() {
7778

7879
// Hack to run sys init during unit testing
7980
if selfPath := utils.SelfPath(); selfPath == "/sbin/init" || selfPath == "/.dockerinit" {
80-
SysInit()
81+
sysinit.SysInit()
8182
return
8283
}
8384

sysinit.go renamed to sysinit/sysinit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package docker
1+
package sysinit
22

33
import (
44
"flag"

0 commit comments

Comments
 (0)