diff --git a/appmgr/Cargo.toml b/appmgr/Cargo.toml index 1050b25ce..e68e062d7 100644 --- a/appmgr/Cargo.toml +++ b/appmgr/Cargo.toml @@ -13,13 +13,14 @@ name = "appmgr" path = "src/main.rs" [features] -default = [] +avahi = ["avahi-sys"] +default = ["avahi"] portable = [] production = [] [dependencies] async-trait = "0.1.42" -avahi-sys = { git = "https://github.com/Start9Labs/avahi-sys", branch = "feature/dynamic-linking", features = ["dynamic"] } +avahi-sys = { git = "https://github.com/Start9Labs/avahi-sys", branch = "feature/dynamic-linking", features = ["dynamic"], optional = true } base32 = "0.4.0" clap = "2.33" ctrlc = "3.1.7" diff --git a/appmgr/src/lib.rs b/appmgr/src/lib.rs index 18b6feb40..aa0400dfe 100644 --- a/appmgr/src/lib.rs +++ b/appmgr/src/lib.rs @@ -31,6 +31,7 @@ pub mod error; pub mod index; pub mod inspect; pub mod install; +#[cfg(feature = "avahi")] pub mod lan; pub mod logs; pub mod manifest; diff --git a/appmgr/src/main.rs b/appmgr/src/main.rs index 5b2630b01..9ae6f3f1b 100644 --- a/appmgr/src/main.rs +++ b/appmgr/src/main.rs @@ -162,6 +162,21 @@ async fn inner_main() -> Result<(), Error> { ), ); + #[cfg(feature = "avahi")] + let app = app.subcommand( + SubCommand::with_name("lan") + .about("Configures LAN services") + .subcommand( + SubCommand::with_name("enable") + .about("Publishes the LAN address for the service over avahi") + .arg( + Arg::with_name("ID") + .help("ID of the application to publish the LAN address for") + .required(true), + ), + ), + ); + #[cfg(not(feature = "portable"))] let mut app = app .subcommand( @@ -448,19 +463,6 @@ async fn inner_main() -> Result<(), Error> { ) .subcommand(SubCommand::with_name("reload").about("Reloads the tor configuration")), ) - .subcommand( - SubCommand::with_name("lan") - .about("Configures LAN services") - .subcommand( - SubCommand::with_name("enable") - .about("Publishes the LAN address for the service over avahi") - .arg( - Arg::with_name("ID") - .help("ID of the application to publish the LAN address for") - .required(true), - ), - ), - ) .subcommand( SubCommand::with_name("info") .about("Prints information about an installed app") @@ -1200,6 +1202,7 @@ async fn inner_main() -> Result<(), Error> { std::process::exit(1); } }, + #[cfg(feature = "avahi")] #[cfg(not(feature = "portable"))] ("lan", Some(sub_m)) => match sub_m.subcommand() { ("enable", Some(sub_sub_m)) => {