mirror of
https://github.com/rancher/os.git
synced 2025-09-03 15:54:24 +00:00
resolve device name using libblkid
This commit is contained in:
@@ -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"},
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
16
util/cutil.go
Normal file
16
util/cutil.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package util
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lblkid -luuid
|
||||
#include<blkid/blkid.h>
|
||||
#include<stdlib.h>
|
||||
*/
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user