Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::Path;

use gtk::prelude::{BuilderExtManual, WidgetExt};

use gtk::traits::ButtonExt;
use serde::Deserialize;
use subprocess::{Exec, Redirection};
use tracing::{error, info};
Expand Down Expand Up @@ -133,18 +134,21 @@ pub fn launch_installer(message: String) {

let install_btn: gtk::Button = builder.object("install").unwrap();
install_btn.set_sensitive(false);
install_btn.set_label("Checking...");

let ui_comp = crate::gui::GUI::new(window_ref.clone());
let checks = [connectivity_check, edition_compat_check, outdated_version_check];
if !checks.iter().all(|x| x(&ui_comp, message.clone())) {
// if any check failed, return
info!("Some ISO check failed!");
install_btn.set_sensitive(true);
install_btn.set_label(&fl!("button-installer-label"));
return;
}

// Spawning child process
info!("ISO checks passed! Starting Installer..");
install_btn.set_label("Launching installer...");
let mut child = Exec::cmd("/usr/local/bin/calamares-online.sh")
.stdout(Redirection::Pipe)
.stderr(Redirection::Merge)
Expand All @@ -166,6 +170,7 @@ pub fn launch_installer(message: String) {
info!("Installer finished with status: {:?}", status);

install_btn.set_sensitive(true);
install_btn.set_label(&fl!("button-installer-label"));
});
}

Expand Down
Loading