mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 11:25:56 +00:00
28 lines
1.0 KiB
Rust
28 lines
1.0 KiB
Rust
//! 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: ®,
|
|
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());
|
|
}
|