1
0
mirror of https://github.com/rancher/os.git synced 2025-09-12 13:17:17 +00:00

Try RANCHER_BOOT first, and if that's not preset, use rancher.state.dev and then RANCHER_STATE

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-03-14 16:22:47 +10:00
parent c62c05773c
commit 1e5baa57da

View File

@@ -750,16 +750,16 @@ func mountdevice(baseName, bootDir, partition string, raw bool) (string, string,
// Don't use ResolveDevice - it can fail, whereas `blkid -L LABEL` works more often
cfg := config.LoadConfig()
if dev := util.ResolveDevice(cfg.Rancher.State.Dev); dev != "" {
// try the rancher.state.dev setting
partition = 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")
} else {
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")
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")
log.Debugf("Run(%v)", cmd)
@@ -770,7 +770,7 @@ func mountdevice(baseName, bootDir, partition string, raw bool) (string, string,
}
}
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 {