new tools added to dispatch
This commit is contained in:
parent
3e017ef9f3
commit
1bf90ca447
@ -1,16 +1,20 @@
|
||||
#[macro_use] extern crate libcitadel;
|
||||
#[macro_use] extern crate failure;
|
||||
#[macro_use] extern crate serde_derive;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::ffi::OsStr;
|
||||
use std::iter;
|
||||
use libcitadel::RealmManager;
|
||||
|
||||
mod boot;
|
||||
mod image;
|
||||
mod install;
|
||||
mod mkimage;
|
||||
mod realmfs;
|
||||
mod sync;
|
||||
|
||||
fn main() {
|
||||
let exe = match env::current_exe() {
|
||||
@ -28,6 +32,12 @@ fn main() {
|
||||
install::main(args);
|
||||
} else if exe == Path::new("/usr/bin/citadel-image") {
|
||||
image::main(args);
|
||||
} else if exe == Path::new("/usr/bin/citadel-realmfs") {
|
||||
realmfs::main(args);
|
||||
} else if exe == Path::new("/usr/libexec/citadel-desktop-sync") {
|
||||
sync::main(args);
|
||||
} else if exe == Path::new("/usr/libexec/citadel-run") {
|
||||
do_citadel_run(args);
|
||||
} else if exe.file_name() == Some(OsStr::new("citadel-mkimage")) {
|
||||
mkimage::main(args);
|
||||
} else if exe.file_name() == Some(OsStr::new("citadel-tool")) {
|
||||
@ -43,7 +53,10 @@ fn dispatch_command(args: Vec<String>) {
|
||||
"boot" => boot::main(rebuild_args("citadel-boot", args)),
|
||||
"install" => install::main(rebuild_args("citadel-install", args)),
|
||||
"image" => image::main(rebuild_args("citadel-image", args)),
|
||||
"realmfs" => realmfs::main(rebuild_args("citadel-realmfs", args)),
|
||||
"mkimage" => mkimage::main(rebuild_args("citadel-mkimage", args)),
|
||||
"sync" => sync::main(rebuild_args("citadel-desktop-sync", args)),
|
||||
"run" => do_citadel_run(rebuild_args("citadel-run", args)),
|
||||
_ => println!("Error: unknown command {}", command),
|
||||
}
|
||||
} else {
|
||||
@ -56,3 +69,10 @@ fn rebuild_args(command: &str, args: Vec<String>) -> Vec<String> {
|
||||
.chain(args.into_iter().skip(2))
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn do_citadel_run(args: Vec<String>) {
|
||||
if let Err(e) = RealmManager::run_in_current(&args[1..], true) {
|
||||
println!("RealmManager::run_in_current({:?}) failed: {}", &args[1..], e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user