new tools added to dispatch

This commit is contained in:
Bruce Leidl 2019-04-02 15:32:36 -04:00
parent 3e017ef9f3
commit 1bf90ca447

View File

@ -1,16 +1,20 @@
#[macro_use] extern crate libcitadel; #[macro_use] extern crate libcitadel;
#[macro_use] extern crate failure; #[macro_use] extern crate failure;
#[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_derive;
#[macro_use] extern crate lazy_static;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::iter; use std::iter;
use libcitadel::RealmManager;
mod boot; mod boot;
mod image; mod image;
mod install; mod install;
mod mkimage; mod mkimage;
mod realmfs;
mod sync;
fn main() { fn main() {
let exe = match env::current_exe() { let exe = match env::current_exe() {
@ -28,6 +32,12 @@ fn main() {
install::main(args); install::main(args);
} else if exe == Path::new("/usr/bin/citadel-image") { } else if exe == Path::new("/usr/bin/citadel-image") {
image::main(args); 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")) { } else if exe.file_name() == Some(OsStr::new("citadel-mkimage")) {
mkimage::main(args); mkimage::main(args);
} else if exe.file_name() == Some(OsStr::new("citadel-tool")) { } 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)), "boot" => boot::main(rebuild_args("citadel-boot", args)),
"install" => install::main(rebuild_args("citadel-install", args)), "install" => install::main(rebuild_args("citadel-install", args)),
"image" => image::main(rebuild_args("citadel-image", 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)), "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), _ => println!("Error: unknown command {}", command),
} }
} else { } else {
@ -56,3 +69,10 @@ fn rebuild_args(command: &str, args: Vec<String>) -> Vec<String> {
.chain(args.into_iter().skip(2)) .chain(args.into_iter().skip(2))
.collect() .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);
}
}