Browse code

Fix cross compile non cgo and linux systems Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)

Michael Crosby authored on 2014/07/17 08:39:15
Showing 7 changed files
... ...
@@ -13,7 +13,6 @@ import (
13 13
 	"time"
14 14
 
15 15
 	"github.com/docker/libcontainer/label"
16
-	"github.com/docker/libcontainer/selinux"
17 16
 	"github.com/dotcloud/docker/archive"
18 17
 	"github.com/dotcloud/docker/daemon/execdriver"
19 18
 	"github.com/dotcloud/docker/daemon/execdriver/execdrivers"
... ...
@@ -300,7 +299,8 @@ func (daemon *Daemon) Destroy(container *Container) error {
300 300
 	if err := os.RemoveAll(container.root); err != nil {
301 301
 		return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err)
302 302
 	}
303
-	selinux.FreeLxcContexts(container.ProcessLabel)
303
+
304
+	selinuxFreeLxcContexts(container.ProcessLabel)
304 305
 
305 306
 	return nil
306 307
 }
... ...
@@ -761,7 +761,7 @@ func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error)
761 761
 
762 762
 func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
763 763
 	if !config.EnableSelinuxSupport {
764
-		selinux.SetDisabled()
764
+		selinuxSetDisabled()
765 765
 	}
766 766
 
767 767
 	// Create the root directory if it doesn't exists
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,cgo
2 2
 
3 3
 package native
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,cgo
2 2
 
3 3
 package native
4 4
 
5 5
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+// +build linux,!cgo
1
+
2
+package native
3
+
4
+import (
5
+	"fmt"
6
+
7
+	"github.com/dotcloud/docker/daemon/execdriver"
8
+)
9
+
10
+func NewDriver(root, initPath string) (execdriver.Driver, error) {
11
+	return nil, fmt.Errorf("native driver not supported on non-linux")
12
+}
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,cgo
2 2
 
3 3
 package native
4 4
 
5 5
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+// +build linux
1
+
2
+package daemon
3
+
4
+import "github.com/docker/libcontainer/selinux"
5
+
6
+func selinuxSetDisabled() {
7
+	selinux.SetDisabled()
8
+}
9
+
10
+func selinuxFreeLxcContexts(label string) {
11
+	selinux.FreeLxcContexts(label)
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+// +build !linux
1
+
2
+package daemon
3
+
4
+func selinuxSetDisabled() {
5
+}
6
+
7
+func selinuxFreeLxcContexts(label string) {
8
+}