From be9874d2f465f072e5238f532d59bc1d3bca8956 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Mon, 13 Mar 2017 14:51:52 +1000 Subject: [PATCH] use the rancher.state.dev cfg to detect where we're installing Signed-off-by: Sven Dowideit --- cmd/control/install.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cmd/control/install.go b/cmd/control/install.go index 36044a96..1ff89c81 100755 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -742,23 +742,29 @@ func mountdevice(baseName, bootDir, partition string, raw bool) (string, string, //rootfs := partition // Don't use ResolveDevice - it can fail, whereas `blkid -L LABEL` works more often - //if dev := util.ResolveDevice("LABEL=RANCHER_BOOT"); dev != "" { - cmd := exec.Command("blkid", "-L", "RANCHER_BOOT") - log.Debugf("Run(%v)", cmd) - cmd.Stderr = os.Stderr - if out, err := cmd.Output(); err == nil { - partition = strings.TrimSpace(string(out)) - baseName = filepath.Join(baseName, "boot") + + cfg := config.LoadConfig() + if dev := util.ResolveDevice(cfg.Rancher.State.Dev); dev != "" { + // try the rancher.state.dev setting + partition = dev } else { - cmd := exec.Command("blkid", "-L", "RANCHER_STATE") + cmd := exec.Command("blkid", "-L", "RANCHER_BOOT") log.Debugf("Run(%v)", cmd) cmd.Stderr = os.Stderr if out, err := cmd.Output(); err == nil { partition = strings.TrimSpace(string(out)) + baseName = filepath.Join(baseName, "boot") + } else { + cmd := exec.Command("blkid", "-L", "RANCHER_STATE") + log.Debugf("Run(%v)", cmd) + cmd.Stderr = os.Stderr + if out, err := cmd.Output(); err == nil { + partition = strings.TrimSpace(string(out)) + } } } device := "" - cmd = exec.Command("lsblk", "-no", "pkname", partition) + cmd := exec.Command("lsblk", "-no", "pkname", partition) log.Debugf("Run(%v)", cmd) cmd.Stderr = os.Stderr if out, err := cmd.Output(); err == nil {