diff --git a/appmgr/src/actions.rs b/appmgr/src/actions.rs index a84a6d406..ae5ba1853 100644 --- a/appmgr/src/actions.rs +++ b/appmgr/src/actions.rs @@ -8,6 +8,7 @@ use yajrc::RpcError; use crate::apps::DockerStatus; pub const STATUS_NOT_ALLOWED: i32 = -2; +pub const INVALID_COMMAND: i32 = -3; #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] #[serde(rename_all = "kebab-case")] @@ -67,6 +68,11 @@ impl Action { cmd } else { let mut cmd = tokio::process::Command::new("docker"); + let entrypoint = self.command.get(0).ok_or_else(|| RpcError { + code: INVALID_COMMAND, + message: "Command Cannot Be Empty".to_owned(), + data: None, + })?; cmd.arg("run") .arg("--rm") .arg("--name") @@ -78,8 +84,10 @@ impl Action { app_id, man.mount.display() )) + .arg("--entrypoint") + .arg(entrypoint) .arg(format!("start9/{}", app_id)) - .args(&self.command); + .args(&self.command[1..]); // TODO: 0.3.0: net, tor, shm cmd }; diff --git a/appmgr/src/pack.rs b/appmgr/src/pack.rs index 82b29e9de..6c347e5cd 100644 --- a/appmgr/src/pack.rs +++ b/appmgr/src/pack.rs @@ -217,6 +217,13 @@ pub async fn verify(path: &str) -> Result<(), failure::Error> { if let Some(shared) = &manifest.shared { validate_path(shared)?; } + for action in &manifest.actions { + ensure!( + !action.command.is_empty(), + "Command Cannot Be Empty: {}", + action.id + ); + } log::info!("Opening config spec from archive."); let config_spec = entries .next()