]> git.proxmox.com Git - pve-installer.git/commitdiff
tui: read and save reboot-after-install checkbox into options
authorChristoph Heiss <c.heiss@proxmox.com>
Thu, 15 Jun 2023 11:28:30 +0000 (13:28 +0200)
committerChristoph Heiss <c.heiss@proxmox.com>
Thu, 15 Jun 2023 11:28:30 +0000 (13:28 +0200)
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
proxmox-tui-installer/src/main.rs
proxmox-tui-installer/src/options.rs

index 8cc068467b21fab84df2aafe1499b59a6798a800..e39325b9cc31621fa8ca53bbe10ce4ca220cf315 100644 (file)
@@ -12,7 +12,7 @@ use cursive::{
     view::{Nameable, Resizable, ViewWrapper},
     views::{
         Button, Checkbox, Dialog, DummyView, EditView, LinearLayout, PaddedView, Panel,
-        ProgressBar, ResizedView, ScrollView, SelectView, TextContent, TextView,
+        ProgressBar, ResizedView, ScrollView, SelectView, TextContent, TextView, ViewRef,
     },
     Cursive, CursiveRunnable, ScreenId, View,
 };
@@ -162,6 +162,7 @@ fn main() {
             timezone: TimezoneOptions::default(),
             password: PasswordOptions::default(),
             network: NetworkOptions::default(),
+            reboot: false,
         },
         available_disks,
         setup_info,
@@ -577,6 +578,15 @@ fn summary_dialog(siv: &mut Cursive) -> InstallerView {
                 .child(Button::new("Previous", switch_to_prev_screen))
                 .child(DummyView)
                 .child(Button::new("Install", |siv| {
+                    let reboot = siv
+                        .find_name("reboot-after-install")
+                        .map(|v: ViewRef<Checkbox>| v.is_checked())
+                        .unwrap_or_default();
+
+                    siv.with_user_data(|state: &mut InstallerState| {
+                        state.options.reboot = reboot;
+                    });
+
                     switch_to_next_screen(siv, InstallerStep::Install, &install_progress_dialog);
                 })),
         ));
index 0eb52bc26bc7884d2afb7f0f0d69663c987596c8..b066021a524d6efb6cdfe6c6ae1e9333d8fec837 100644 (file)
@@ -314,6 +314,7 @@ pub struct InstallerOptions {
     pub timezone: TimezoneOptions,
     pub password: PasswordOptions,
     pub network: NetworkOptions,
+    pub reboot: bool,
 }
 
 impl InstallerOptions {