diff --git a/README.md b/README.md index 971c9df..00f1331 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ image = "" # Podman image name depend = [""] # Name of any service in /etc/init.d to depend on restart = "unless-stopped" # Restart, optional. Defaults to "unless-stopped" detach = true # Run container in detach mode, optional, default true. Recommended. +interactive = false # Run container in interactive mode, optional, default false hostname = "" # Host name, optional. command = "" # Container command to run, optional. diff --git a/src/main.rs b/src/main.rs index 09629f2..fc8e6fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ pub fn generate_openrc(config: &ServiceConfig) -> String { script.push_str("start_pre() {\n"); let mut start_pre_commands = Vec::new(); start_pre_commands.push(format!("podman rm {} --ignore;", config.service.name)); - for network in networks.iter() { + for network in networks.iter().filter(|n| *n != "host" && *n != "bridge") { start_pre_commands.push(format!("podman network create {} --ignore;", network)); } for volume in config.volumes.iter().filter(|v| v.create.is_some_and(|c|c)) { @@ -73,6 +73,10 @@ pub fn generate_openrc(config: &ServiceConfig) -> String { arguments.push("--detach".to_string()); } + if config.service.interactive.unwrap_or(false) { + arguments.push("--interactive".to_string()); + } + for network in networks.iter() { arguments.push(format!("--network {}", network)); } @@ -177,7 +181,7 @@ pub fn generate_openrc(config: &ServiceConfig) -> String { script.push_str("cleanup() {\n"); let mut cleanup_commands = Vec::new(); cleanup_commands.push(format!("podman rm {} --ignore --force;", config.service.name)); - for network in networks.iter() { + for network in networks.iter().filter(|n| *n != "host" && *n != "bridge") { cleanup_commands.push(format!("podman network rm {} --force;", network)); } for volume in config.volumes.iter().filter(|v| v.create.is_some_and(|c|c)) { diff --git a/src/service.rs b/src/service.rs index b9f5de9..8d43c15 100644 --- a/src/service.rs +++ b/src/service.rs @@ -41,6 +41,7 @@ pub struct Service { pub restart: Option, pub detach: Option, + pub interactive: Option, pub healthcheck: Option, pub command: Option,