]> git.proxmox.com Git - pve-installer.git/commitdiff
auto-installer: handle auto-reboot info messages directly
authorChristoph Heiss <c.heiss@proxmox.com>
Mon, 22 Apr 2024 12:11:07 +0000 (14:11 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Apr 2024 12:31:37 +0000 (14:31 +0200)
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
proxmox-auto-installer/src/utils.rs
proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
proxmox-auto-installer/tests/resources/parse_answer/minimal.json
proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
proxmox-auto-installer/tests/resources/parse_answer/zfs.json

index 6e4848c6d3cb4a8a69d77437a150d3531552c342..f961a80c8dc981fe3024a9df7b45d0696ccde489 100644 (file)
@@ -5,6 +5,8 @@ use std::{
     io::{BufRead, BufReader, Write},
     path::PathBuf,
     process::ExitCode,
+    thread,
+    time::Duration,
 };
 
 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
 
+    for secs in (0..=5).rev() {
+        info!("Installation finished - auto-rebooting in {secs} seconds ..");
+        thread::sleep(Duration::from_secs(1));
+    }
+
     ExitCode::SUCCESS
 }
 
@@ -170,7 +177,8 @@ fn run_installation(
                     if state == "err" {
                         bail!("{message}");
                     }
-                    info!("Finished: '{state}' {message}");
+                    // Do not print anything if the installation was successful,
+                    // as we handle that here ourselves
                 }
             };
         }
index b1d60cb02e3b8761f9b5e110e1d5d73bc6556e0c..168e5cb261496ae85a5061bb4f5811ea7329158a 100644 (file)
@@ -368,7 +368,7 @@ pub fn parse_answer(
     verify_locale_settings(answer, locales)?;
 
     let mut config = InstallConfig {
-        autoreboot: 1_usize,
+        autoreboot: 0,
         filesys: filesystem,
         hdsize: 0.,
         swapsize: None,
@@ -426,6 +426,11 @@ pub fn parse_answer(
                 .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)
 }
 
index f228b1e3411d76d3022a15c889cbf1461f36d9b8..bc19d88ce4958579e30d85410d2d5c49db8864e3 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "192.168.1.114/24",
   "country": "at",
   "dns": "192.168.1.254",
index 299092232280f0c680a2e3306344cbe036d3ea91..ce2071e72e31244381a0750496ea44229a403fab 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "192.168.1.114/24",
   "country": "at",
   "dns": "192.168.1.254",
index 8c22300f336da3861415c68b21df9f7d0779d98d..ae4debe5c5ba4fedff8b2fe5a164e51294b93cf8 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "192.168.1.114/24",
   "country": "at",
   "dns": "192.168.1.254",
index 9021377c2dd6a98c39ee91b8eaba0bbbe965bb72..4312ccd884193d2f759095b642391f3c7a4c5995 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "192.168.1.114/24",
   "country": "at",
   "dns": "192.168.1.254",
index 6f31079609e296bcd64e769df132bc3cd756cb1e..6d16a3acc1c81d1ec34db6541b24a8341526f543 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "10.10.10.10/24",
   "country": "at",
   "dns": "10.10.10.1",
index 515cc89eb44f86214d7f9b1d511a018ec4632661..51ab029e39428c214c11321cb03be18720795c66 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "10.10.10.10/24",
   "country": "at",
   "dns": "10.10.10.1",
index c29a3038bccbaceede8ed2b497e625deafdbaeb7..05804828b84d8b9623d4776b01e20edfa0bb3700 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "autoreboot": 1,
+  "autoreboot": 0,
   "cidr": "192.168.1.114/24",
   "country": "at",
   "dns": "192.168.1.254",