auto-installer: handle auto-reboot info messages directly

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Christoph Heiss 2024-04-22 14:11:07 +02:00 committed by Thomas Lamprecht
parent dd29e29454
commit 5878dc4ae6
9 changed files with 22 additions and 9 deletions

View File

@ -5,6 +5,8 @@ use std::{
io::{BufRead, BufReader, Write}, io::{BufRead, BufReader, Write},
path::PathBuf, path::PathBuf,
process::ExitCode, process::ExitCode,
thread,
time::Duration,
}; };
use proxmox_installer_common::setup::{ use proxmox_installer_common::setup::{
@ -94,6 +96,11 @@ fn main() -> ExitCode {
// TODO: (optionally) do a HTTP post with basic system info, like host SSH public key(s) here // TODO: (optionally) do a HTTP post with basic system info, like host SSH public key(s) here
for secs in (0..=5).rev() {
info!("Installation finished - auto-rebooting in {secs} seconds ..");
thread::sleep(Duration::from_secs(1));
}
ExitCode::SUCCESS ExitCode::SUCCESS
} }
@ -170,7 +177,8 @@ fn run_installation(
if state == "err" { if state == "err" {
bail!("{message}"); bail!("{message}");
} }
info!("Finished: '{state}' {message}"); // Do not print anything if the installation was successful,
// as we handle that here ourselves
} }
}; };
} }

View File

@ -368,7 +368,7 @@ pub fn parse_answer(
verify_locale_settings(answer, locales)?; verify_locale_settings(answer, locales)?;
let mut config = InstallConfig { let mut config = InstallConfig {
autoreboot: 1_usize, autoreboot: 0,
filesys: filesystem, filesys: filesystem,
hdsize: 0., hdsize: 0.,
swapsize: None, swapsize: None,
@ -426,6 +426,11 @@ pub fn parse_answer(
.unwrap_or(runtime_info.disks[first_selected_disk].size); .unwrap_or(runtime_info.disks[first_selected_disk].size);
} }
} }
// never print the auto reboot text after finishing to avoid the delay, as this is handled by
// the auto-installer itself anyway. The auto-installer might still perform some post-install
// steps after running the low-level installer.
config.autoreboot = 0;
Ok(config) Ok(config)
} }

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "192.168.1.114/24", "cidr": "192.168.1.114/24",
"country": "at", "country": "at",
"dns": "192.168.1.254", "dns": "192.168.1.254",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "192.168.1.114/24", "cidr": "192.168.1.114/24",
"country": "at", "country": "at",
"dns": "192.168.1.254", "dns": "192.168.1.254",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "192.168.1.114/24", "cidr": "192.168.1.114/24",
"country": "at", "country": "at",
"dns": "192.168.1.254", "dns": "192.168.1.254",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "192.168.1.114/24", "cidr": "192.168.1.114/24",
"country": "at", "country": "at",
"dns": "192.168.1.254", "dns": "192.168.1.254",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "10.10.10.10/24", "cidr": "10.10.10.10/24",
"country": "at", "country": "at",
"dns": "10.10.10.1", "dns": "10.10.10.1",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "10.10.10.10/24", "cidr": "10.10.10.10/24",
"country": "at", "country": "at",
"dns": "10.10.10.1", "dns": "10.10.10.1",

View File

@ -1,5 +1,5 @@
{ {
"autoreboot": 1, "autoreboot": 0,
"cidr": "192.168.1.114/24", "cidr": "192.168.1.114/24",
"country": "at", "country": "at",
"dns": "192.168.1.254", "dns": "192.168.1.254",