mirror of
https://github.com/rancher/os.git
synced 2025-09-05 08:42:38 +00:00
resolve device name using libblkid
This commit is contained in:
@@ -41,6 +41,7 @@ type Config struct {
|
|||||||
SystemDockerArgs []string `json:"systemDockerArgs,omitempty"`
|
SystemDockerArgs []string `json:"systemDockerArgs,omitempty"`
|
||||||
UserContainers []ContainerConfig `json:"userContainser,omitempty"`
|
UserContainers []ContainerConfig `json:"userContainser,omitempty"`
|
||||||
UserInit string `json:"userInit,omitempty"`
|
UserInit string `json:"userInit,omitempty"`
|
||||||
|
DockerBin string `json:"dockerBin,omitempty"`
|
||||||
Modules []string `json:"modules,omitempty"`
|
Modules []string `json:"modules,omitempty"`
|
||||||
Respawn []string `json:"respawn,omitempty"`
|
Respawn []string `json:"respawn,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,7 @@ func LoadConfig() (*Config, error) {
|
|||||||
func NewConfig() *Config {
|
func NewConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
ConsoleContainer: "console",
|
ConsoleContainer: "console",
|
||||||
|
DockerBin: "/usr/bin/docker",
|
||||||
Debug: true,
|
Debug: true,
|
||||||
DockerEndpoint: "unix:/var/run/docker.sock",
|
DockerEndpoint: "unix:/var/run/docker.sock",
|
||||||
Dns: []string{
|
Dns: []string{
|
||||||
@@ -79,7 +81,7 @@ func NewConfig() *Config {
|
|||||||
ImagesPath: "/",
|
ImagesPath: "/",
|
||||||
ImagesPattern: "images*.tar",
|
ImagesPattern: "images*.tar",
|
||||||
StateRequired: false,
|
StateRequired: false,
|
||||||
StateDev: "/dev/sda",
|
StateDev: "LABEL=RANCHER_STATE",
|
||||||
StateDevFSType: "ext4",
|
StateDevFSType: "ext4",
|
||||||
SysInit: "/sbin/init-sys",
|
SysInit: "/sbin/init-sys",
|
||||||
SystemDockerArgs: []string{"docker", "-d", "-s", "overlay", "-b", "none"},
|
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")
|
log.Debugf("State will not be persisted")
|
||||||
err = util.Mount("none", STATE, "tmpfs", "")
|
err = util.Mount("none", STATE, "tmpfs", "")
|
||||||
} else {
|
} 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, "")
|
err = util.Mount(cfg.StateDev, STATE, cfg.StateDevFSType, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
//}
|
}
|
||||||
|
|
||||||
//for _, i := range []string{"docker", "images"} {
|
//for _, i := range []string{"docker", "images"} {
|
||||||
// dir := path.Join(STATE, i)
|
// dir := path.Join(STATE, i)
|
||||||
|
@@ -5,7 +5,7 @@ set -x
|
|||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
apt-get update
|
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
|
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