1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 23:34:57 +00:00

use the rancher.state.dev cfg to detect where we're installing

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-03-13 14:51:52 +10:00
parent 8a4fa93202
commit be9874d2f4

View File

@@ -742,23 +742,29 @@ func mountdevice(baseName, bootDir, partition string, raw bool) (string, string,
//rootfs := partition //rootfs := partition
// Don't use ResolveDevice - it can fail, whereas `blkid -L LABEL` works more often // 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") cfg := config.LoadConfig()
log.Debugf("Run(%v)", cmd) if dev := util.ResolveDevice(cfg.Rancher.State.Dev); dev != "" {
cmd.Stderr = os.Stderr // try the rancher.state.dev setting
if out, err := cmd.Output(); err == nil { partition = dev
partition = strings.TrimSpace(string(out))
baseName = filepath.Join(baseName, "boot")
} else { } else {
cmd := exec.Command("blkid", "-L", "RANCHER_STATE") cmd := exec.Command("blkid", "-L", "RANCHER_BOOT")
log.Debugf("Run(%v)", cmd) log.Debugf("Run(%v)", cmd)
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
if out, err := cmd.Output(); err == nil { if out, err := cmd.Output(); err == nil {
partition = strings.TrimSpace(string(out)) 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 := "" device := ""
cmd = exec.Command("lsblk", "-no", "pkname", partition) cmd := exec.Command("lsblk", "-no", "pkname", partition)
log.Debugf("Run(%v)", cmd) log.Debugf("Run(%v)", cmd)
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
if out, err := cmd.Output(); err == nil { if out, err := cmd.Output(); err == nil {