diff options
Diffstat (limited to 'crates/core/tedge/src/main.rs')
-rw-r--r-- | crates/core/tedge/src/main.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/core/tedge/src/main.rs b/crates/core/tedge/src/main.rs index eab007f6..ea5ccd9a 100644 --- a/crates/core/tedge/src/main.rs +++ b/crates/core/tedge/src/main.rs @@ -1,11 +1,10 @@ #![forbid(unsafe_code)] #![deny(clippy::mem_forget)] -use std::path::PathBuf; +use std::path::Path; use anyhow::Context; use clap::Parser; -use tedge_users::UserManager; mod cli; mod command; mod error; @@ -16,6 +15,9 @@ type ConfigError = crate::error::TEdgeError; use command::{BuildCommand, BuildContext}; +const BROKER_USER: &str = "mosquitto"; +const BROKER_GROUP: &str = "mosquitto"; + fn main() -> anyhow::Result<()> { let opt = cli::Opt::parse(); @@ -24,15 +26,12 @@ fn main() -> anyhow::Result<()> { return Ok(()); } - let user_manager = UserManager::new(); let tedge_config_location = tedge_config::TEdgeConfigLocation::from_custom_root(opt.config_dir); - let _user_guard = user_manager.become_user(tedge_users::TEDGE_USER)?; let config_repository = tedge_config::TEdgeConfigRepository::new(tedge_config_location.clone()); let build_context = BuildContext { config_repository, config_location: tedge_config_location, - user_manager, }; if let Some(tedge_opt) = opt.tedge { @@ -47,8 +46,8 @@ fn main() -> anyhow::Result<()> { } } -fn initialize_tedge(cfg_dir: &PathBuf) -> anyhow::Result<()> { - let config_dir = cfg_dir.as_path().display().to_string(); +fn initialize_tedge(cfg_dir: &Path) -> anyhow::Result<()> { + let config_dir = cfg_dir.display().to_string(); create_directory_with_user_group(&config_dir, "tedge", "tedge", 0o775)?; create_directory_with_user_group("/var/log/tedge", "tedge", "tedge", 0o775)?; create_directory_with_user_group( |