1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 07:15:41 +00:00

make yN and reboot happen in the console container, not in the installer sub-container

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-01-17 22:13:35 +10:00
parent 7e32fcc7d3
commit 1761d770c9
2 changed files with 14 additions and 14 deletions

View File

@@ -127,14 +127,19 @@ func installAction(c *cli.Context) error {
cloudConfig = uc
}
if err := runInstall(image, installType, cloudConfig, device, kappend, force, reboot, kexec, isoinstallerloaded); err != nil {
if err := runInstall(image, installType, cloudConfig, device, kappend, force, kexec, isoinstallerloaded); err != nil {
log.WithFields(log.Fields{"err": err}).Fatal("Failed to run install")
}
if !kexec && reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}
return nil
}
func runInstall(image, installType, cloudConfig, device, kappend string, force, reboot, kexec, isoinstallerloaded bool) error {
func runInstall(image, installType, cloudConfig, device, kappend string, force, kexec, isoinstallerloaded bool) error {
fmt.Printf("Installing from %s\n", image)
if !force {
@@ -227,12 +232,10 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
"-d", device,
"-i", image, // TODO: this isn't used - I'm just using it to over-ride the defaulting
}
if force {
installerCmd = append(installerCmd, "-f")
}
if !reboot {
installerCmd = append(installerCmd, "--no-reboot")
}
// Need to call the inner container with force - the outer one does the "are you sure"
installerCmd = append(installerCmd, "-f")
// The outer container does the reboot (if needed)
installerCmd = append(installerCmd, "--no-reboot")
if cloudConfig != "" {
installerCmd = append(installerCmd, "-c", cloudConfig)
}
@@ -304,11 +307,6 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
return err
}
if !kexec && reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}
return nil
}