//! Read-only native updater OS-port preflight. No activation/capability proof. #[cfg(all(windows, feature = "system-helper"))] fn main() -> anyhow::Result<()> { use rmm_agent_core::helper_reconcile::BootSource; use rmm_agent_windows::{ helper_system, update_native::{Budget, Role, files, services::Running}, }; use std::time::Duration; use uuid::Uuid; struct Boot(Uuid); impl BootSource for Boot { fn current_boot(&self) -> anyhow::Result { Ok(self.0) } } let runtime = tokio::runtime::Builder::new_current_thread() .enable_all() .build()?; let boot = Boot( runtime .block_on(rmm_agent_windows::native::boot_id())? .parse()?, ); let budget = Budget::new(&boot, boot.0, Duration::from_secs(30))?; let (settings, _guards) = helper_system::read_settings()?; let mut running = Running::observe([settings.agent.clone(), settings.helper.clone()], &budget)?; let mut files = Vec::new(); for role in [ Role::Agent, Role::Helper, Role::Settings, Role::Pin, Role::TimeProfile, ] { files.push(serde_json::json!({"role":role,"proof":files::observe(role, &budget)?})); } running.check(&budget)?; println!( "{}", serde_json::to_string(&serde_json::json!({ "schema_version":1,"read_only":true,"boot_id":boot.0, "services":running.proofs(),"files":files,"native_apply_tested":false, "job_created":false,"capability_qualified":false }))? ); Ok(()) } #[cfg(not(all(windows, feature = "system-helper")))] fn main() { eprintln!("Windows with system-helper feature required; no test executed"); std::process::exit(2); }