Example: install from a package URL (used to verify the published base release)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-09-30 13:18:10 +05:00
1 parent f620f87432
commit ba2515145f
1 file changed
+13
+13
View File
@@ -0,0 +1,13 @@
//! Install from a package URL into a NEW folder (production trust key). usage: install_pkg <package url> <destination>
use coa_core::download::Cancel;
use coa_core::install::{install_base, Params, Source};
use coa_core::registry::Registry;
fn main() {
let a: Vec<String> = std::env::args().skip(1).collect();
let reg = Registry::at(std::env::temp_dir().join("coa-install-url").join("installs.json"));
let _ = std::fs::remove_dir_all(std::env::temp_dir().join("coa-install-url"));
let t = std::time::Instant::now();
let r = install_base(&Params { source: Source::Url(a[0].clone()), dest: a[1].clone().into(), trusted_key: coa_core::signing::EMBEDDED_PUBLIC_KEY, registry: &reg, cancel: Cancel::default() }, &|s| eprintln!(" {:>3}% {}", s.percent, s.step)).unwrap_or_else(|e| panic!("install failed: {e:?}"));
println!("installed {} at {} in {:?}", r.version, r.path, t.elapsed());
}