1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

Fix cross compile non cgo and linux systems

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
Upstream-commit: 7a8ea91392e0cc97caf2a6edc3b262b33a5b446d
Component: engine
This commit is contained in:
Michael Crosby
2014-07-16 16:39:15 -07:00
parent d18a40b4ac
commit f48be61b0a
7 changed files with 41 additions and 6 deletions

View File

@@ -13,7 +13,6 @@ import (
"time"
"github.com/docker/libcontainer/label"
"github.com/docker/libcontainer/selinux"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/daemon/execdriver"
"github.com/dotcloud/docker/daemon/execdriver/execdrivers"
@@ -300,7 +299,8 @@ func (daemon *Daemon) Destroy(container *Container) error {
if err := os.RemoveAll(container.root); err != nil {
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err)
}
selinux.FreeLxcContexts(container.ProcessLabel)
selinuxFreeLxcContexts(container.ProcessLabel)
return nil
}
@@ -761,7 +761,7 @@ func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error)
func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
if !config.EnableSelinuxSupport {
selinux.SetDisabled()
selinuxSetDisabled()
}
// Create the root directory if it doesn't exists

View File

@@ -1,4 +1,4 @@
// +build linux
// +build linux,cgo
package native

View File

@@ -1,4 +1,4 @@
// +build linux
// +build linux,cgo
package native

View File

@@ -0,0 +1,13 @@
// +build linux,!cgo
package native
import (
"fmt"
"github.com/dotcloud/docker/daemon/execdriver"
)
func NewDriver(root, initPath string) (execdriver.Driver, error) {
return nil, fmt.Errorf("native driver not supported on non-linux")
}

View File

@@ -1,4 +1,4 @@
// +build linux
// +build linux,cgo
package native

View File

@@ -0,0 +1,13 @@
// +build linux
package daemon
import "github.com/docker/libcontainer/selinux"
func selinuxSetDisabled() {
selinux.SetDisabled()
}
func selinuxFreeLxcContexts(label string) {
selinux.FreeLxcContexts(label)
}

View File

@@ -0,0 +1,9 @@
// +build !linux
package daemon
func selinuxSetDisabled() {
}
func selinuxFreeLxcContexts(label string) {
}