diff --git a/config/config.go b/config/config.go index d6c1365a..87926aa6 100644 --- a/config/config.go +++ b/config/config.go @@ -41,6 +41,7 @@ type Config struct { SystemDockerArgs []string `json:"systemDockerArgs,omitempty"` UserContainers []ContainerConfig `json:"userContainser,omitempty"` UserInit string `json:"userInit,omitempty"` + DockerBin string `json:"dockerBin,omitempty"` Modules []string `json:"modules,omitempty"` Respawn []string `json:"respawn,omitempty"` } @@ -70,16 +71,17 @@ func LoadConfig() (*Config, error) { func NewConfig() *Config { return &Config{ ConsoleContainer: "console", + DockerBin: "/usr/bin/docker", Debug: true, DockerEndpoint: "unix:/var/run/docker.sock", Dns: []string{ "8.8.8.8", "8.8.4.4", }, - ImagesPath: "/", - ImagesPattern: "images*.tar", - StateRequired: false, - StateDev: "/dev/sda", + ImagesPath: "/", + ImagesPattern: "images*.tar", + StateRequired: false, + StateDev: "LABEL=RANCHER_STATE", StateDevFSType: "ext4", SysInit: "/sbin/init-sys", SystemDockerArgs: []string{"docker", "-d", "-s", "overlay", "-b", "none"}, diff --git a/init/init.go b/init/init.go index 524a3572..0f2426b4 100644 --- a/init/init.go +++ b/init/init.go @@ -217,13 +217,13 @@ func mountState(cfg *config.Config) error { log.Debugf("State will not be persisted") err = util.Mount("none", STATE, "tmpfs", "") } else { - log.Debugf("Mounting state device %s to %s", cfg.StateDev, STATE) + log.Debugf("Mounting state device %s", cfg.StateDev) err = util.Mount(cfg.StateDev, STATE, cfg.StateDevFSType, "") } - //if err != nil { - return err - //} + if err != nil { + return err + } //for _, i := range []string{"docker", "images"} { // dir := path.Join(STATE, i) diff --git a/scripts/bootstrap b/scripts/bootstrap index d460226d..3abb7e85 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -5,7 +5,7 @@ set -x cd $(dirname $0)/.. apt-get update -apt-get install -y curl rsync build-essential syslinux xorriso +apt-get install -y curl rsync build-essential syslinux xorriso libblkid-dev curl -sL https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0 > /usr/bin/docker diff --git a/util/cutil.go b/util/cutil.go new file mode 100644 index 00000000..6c77b3b8 --- /dev/null +++ b/util/cutil.go @@ -0,0 +1,16 @@ +package util + +/* +#cgo LDFLAGS: -lblkid -luuid +#include +#include +*/ +import "C" +import "unsafe" + +func ResolveDevice(spec string) string { + cString := C.blkid_evaluate_spec(C.CString(spec), nil) + defer C.free(unsafe.Pointer(cString)) + return C.GoString(cString) +} +