From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 521CEC38C for ; Thu, 6 Jul 2023 13:52:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2BECF1E830 for ; Thu, 6 Jul 2023 13:52:17 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 6 Jul 2023 13:52:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 98D5E46906 for ; Thu, 6 Jul 2023 13:52:15 +0200 (CEST) From: Noel Ullreich To: pve-devel@lists.proxmox.com Date: Thu, 6 Jul 2023 13:52:12 +0200 Message-Id: <20230706115212.86875-1-n.ullreich@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.062 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH pve_installer] tui-installer: don't aborted install if min requirements not met X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2023 11:52:17 -0000 If the minimum requirements are not met, the TUI installer will create a popup notifying you that the install might not work and then exits the installer. While the GUI also creates such a popup, it will not exit the installer. This patch adapts the behavior of the GUI: the TUI creates a popup warning you that min spec is not met but doesn't abort the install. Signed-off-by: Noel Ullreich --- proxmox-tui-installer/src/main.rs | 17 +++++++++++++++-- proxmox-tui-installer/src/system.rs | 14 +------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs index 64f21fa..e9a3fb4 100644 --- a/proxmox-tui-installer/src/main.rs +++ b/proxmox-tui-installer/src/main.rs @@ -191,6 +191,8 @@ fn main() { Err(err) => initial_setup_error(&mut siv, &err), }; + has_min_requirements(&runtime_info, &mut siv); + siv.clear_global_callbacks(Event::CtrlChar('c')); siv.set_on_pre_event(Event::CtrlChar('c'), trigger_abort_install_dialog); @@ -243,8 +245,6 @@ fn installer_setup(in_test_mode: bool) -> Result<(LocaleInfo, RuntimeInfo), Stri .map_err(|err| format!("Failed to retrieve runtime environment info: {err}"))? }; - system::has_min_requirements(&runtime_info)?; - runtime_info.disks.sort(); if runtime_info.disks.is_empty() { Err("The installer could not find any supported hard disks.".to_owned()) @@ -291,6 +291,19 @@ fn initial_setup_error(siv: &mut CursiveRunnable, message: &str) -> ! { std::process::exit(1); } +fn has_min_requirements(info: &RuntimeInfo, siv: &mut CursiveRunnable) -> () { + if info.total_memory < 1024 { + siv.add_layer( + Dialog::around(TextView::new(concat!( + "Less than 1 GiB of usable memory detected, installation will probably fail.\n\n", + "See 'System Requirements' in the documentation."))) + .title("Installer setup error") + .button("Ok", Cursive::quit), + ); + siv.run(); + } +} + fn display_setup_warning(siv: &mut Cursive, message: &str) { siv.add_layer(Dialog::info(message).title("Warning")); } diff --git a/proxmox-tui-installer/src/system.rs b/proxmox-tui-installer/src/system.rs index baceab9..7378dba 100644 --- a/proxmox-tui-installer/src/system.rs +++ b/proxmox-tui-installer/src/system.rs @@ -1,18 +1,6 @@ use std::{fs::OpenOptions, io::Write, process::Command}; -use crate::setup::{KeyboardMapping, RuntimeInfo}; - -pub fn has_min_requirements(info: &RuntimeInfo) -> Result<(), String> { - if info.total_memory < 1024 { - return Err(concat!( - "Less than 1 GiB of usable memory detected, installation will probably fail.\n\n", - "See 'System Requirements' in the documentation." - ) - .to_owned()); - } - - Ok(()) -} +use crate::setup::{KeyboardMapping}; pub fn set_keyboard_layout(kmap: &KeyboardMapping) -> Result<(), String> { Command::new("setxkbmap") -- 2.39.2