diff options
author | Rina Fujino <18257209+rina23q@users.noreply.github.com> | 2022-01-10 17:57:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 17:57:41 +0100 |
commit | 3ab4cf779ebacafd5990285d07ccfe03bebaea03 (patch) | |
tree | ae8f06bc774a39f2575abf933cb92a04fc710a79 /crates/core/tedge/src/cli/connect | |
parent | 9c4dee566f25a7a3a2b2548a03d0c4a4bf65b66e (diff) |
#639 Remove the dependency on systemd (#729)
* The purpose of this change is to get rid of the hard-coded dependencies on systemd from tedge connect/disconnect, to allow users to use other system managers, e.g. OpenRC, initd, etc..
* If /etc/tedge/system.toml exists, tedge connect/disconnect uses the service manager defined in the file.
* If the file is not given by user, tedge connect/disconnect uses /bin/systemctl as the service manager. (the same behaviour as we have it so far)
* Delete old service implementation files for BSD, OpenRC, systemd, and NULL.
* Add system.toml example files for BSD and OpenRC.
* Add a reference guide to explain the format of system.toml configuration file.
Signed-off-by: Rina Fujino <18257209+rina23q@users.noreply.github.com>
Diffstat (limited to 'crates/core/tedge/src/cli/connect')
-rw-r--r-- | crates/core/tedge/src/cli/connect/cli.rs | 15 | ||||
-rw-r--r-- | crates/core/tedge/src/cli/connect/command.rs | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/crates/core/tedge/src/cli/connect/cli.rs b/crates/core/tedge/src/cli/connect/cli.rs index 42e68885..1f3e2643 100644 --- a/crates/core/tedge/src/cli/connect/cli.rs +++ b/crates/core/tedge/src/cli/connect/cli.rs @@ -1,5 +1,6 @@ use crate::cli::connect::*; use crate::command::{BuildCommand, BuildContext, Command}; +use crate::system_services::service_manager; use structopt::StructOpt; #[derive(StructOpt, Debug, PartialEq)] @@ -27,20 +28,26 @@ impl BuildCommand for TEdgeConnectOpt { fn build_command(self, context: BuildContext) -> Result<Box<dyn Command>, crate::ConfigError> { Ok(match self { TEdgeConnectOpt::C8y { is_test_connection } => ConnectCommand { - config_location: context.config_location, + config_location: context.config_location.clone(), config_repository: context.config_repository, cloud: Cloud::C8y, common_mosquitto_config: CommonMosquittoConfig::default(), is_test_connection, - service_manager: context.service_manager.clone(), + service_manager: service_manager( + context.user_manager.clone(), + context.config_location.tedge_config_root_path, + )?, }, TEdgeConnectOpt::Az { is_test_connection } => ConnectCommand { - config_location: context.config_location, + config_location: context.config_location.clone(), config_repository: context.config_repository, cloud: Cloud::Azure, common_mosquitto_config: CommonMosquittoConfig::default(), is_test_connection, - service_manager: context.service_manager.clone(), + service_manager: service_manager( + context.user_manager.clone(), + context.config_location.tedge_config_root_path, + )?, }, } .into_boxed()) diff --git a/crates/core/tedge/src/cli/connect/command.rs b/crates/core/tedge/src/cli/connect/command.rs index fb2f9d17..262e6163 100644 --- a/crates/core/tedge/src/cli/connect/command.rs +++ b/crates/core/tedge/src/cli/connect/command.rs @@ -431,7 +431,9 @@ fn new_bridge( println!("Checking if {} is available.\n", service_manager.name()); let service_manager_result = service_manager.check_operational(); - if let Err(SystemServiceError::ServiceManagerUnavailable(name)) = &service_manager_result { + if let Err(SystemServiceError::ServiceManagerUnavailable { cmd: _, name }) = + &service_manager_result + { println!( "Warning: '{}' service manager is not available on the system.\n", name |