public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] tui: use EULA path from ISO info instead of hard-coding
@ 2023-07-14  9:29 Christoph Heiss
  2023-07-17 13:09 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2023-07-14  9:29 UTC (permalink / raw)
  To: pve-devel

.. in the same fashion as the GUI installer.
See also proxinstall:create_intro_view() for reference.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-tui-installer/src/main.rs  | 10 ++++++----
 proxmox-tui-installer/src/setup.rs | 17 ++++++++++++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 42f278b..b87e14f 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -391,9 +391,11 @@ fn abort_install_button() -> Button {
     Button::new("Abort", trigger_abort_install_dialog)
 }
 
-fn get_eula() -> String {
-    // TODO: properly using info from Proxmox::Install::Env::setup()
-    std::fs::read_to_string("/cdrom/EULA")
+fn get_eula(setup: &SetupInfo) -> String {
+    let mut path = setup.locations.iso.clone();
+    path.push("EULA");
+
+    std::fs::read_to_string(path)
         .unwrap_or_else(|_| "< Debug build - ignoring non-existing EULA >".to_owned())
 }
 
@@ -417,7 +419,7 @@ fn license_dialog(siv: &mut Cursive) -> InstallerView {
             TextView::new("END USER LICENSE AGREEMENT (EULA)").center(),
         ))
         .child(Panel::new(ScrollView::new(
-            TextView::new(get_eula()).center(),
+            TextView::new(get_eula(&state.setup_info)).center(),
         )))
         .child(PaddedView::lrtb(1, 1, 1, 0, bbar));
 
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index 8c64c65..5e07f36 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -1,4 +1,12 @@
-use std::{cmp, collections::HashMap, fmt, fs::File, io::BufReader, net::IpAddr, path::Path};
+use std::{
+    cmp,
+    collections::HashMap,
+    fmt,
+    fs::File,
+    io::BufReader,
+    net::IpAddr,
+    path::{Path, PathBuf},
+};
 
 use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
 
@@ -43,12 +51,19 @@ pub struct IsoInfo {
     pub isorelease: String,
 }
 
+/// Paths in the ISO environment containing installer data.
+#[derive(Clone, Deserialize)]
+pub struct IsoLocations {
+    pub iso: PathBuf,
+}
+
 #[derive(Clone, Deserialize)]
 pub struct SetupInfo {
     #[serde(rename = "product-cfg")]
     pub config: ProductConfig,
     #[serde(rename = "iso-info")]
     pub iso_info: IsoInfo,
+    pub locations: IsoLocations,
 }
 
 #[derive(Clone, Deserialize)]
-- 
2.41.0





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-17 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14  9:29 [pve-devel] [PATCH installer] tui: use EULA path from ISO info instead of hard-coding Christoph Heiss
2023-07-17 13:09 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal