Update
This commit is contained in:
@@ -30,6 +30,7 @@ image = "<IMAGE>" # Podman image name
|
||||
depend = ["<SERVICE NAME>"] # 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 = "<HOSTNAME>" # Host name, optional.
|
||||
command = "<COMMAND>" # Container command to run, optional.
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -41,6 +41,7 @@ pub struct Service {
|
||||
|
||||
pub restart: Option<String>,
|
||||
pub detach: Option<bool>,
|
||||
pub interactive: Option<bool>,
|
||||
pub healthcheck: Option<HealthCheck>,
|
||||
pub command: Option<String>,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user