]> git.proxmox.com Git - pve-installer.git/commitdiff
tui: use EULA path from ISO info instead of hard-coding
authorChristoph Heiss <c.heiss@proxmox.com>
Fri, 14 Jul 2023 09:29:47 +0000 (11:29 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 15 Jul 2023 21:41:34 +0000 (23:41 +0200)
.. 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
proxmox-tui-installer/src/setup.rs

index 42f278b6bb850b8829c8243d5929ac3a1cc9470c..b87e14f1b889f6aadc929775d6467ea6a7a0c176 100644 (file)
@@ -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));
 
index 8c64c651e3db65094bfd59043ebc6e65ed7d09d0..5e07f362de5c79135f6a314c46d276c250e177ed 100644 (file)
@@ -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)]