From 3b5baaddec8c7c9130a35f4b23b7aa4d4f2a5de0 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Thu, 4 Aug 2022 19:10:37 +0200 Subject: [PATCH 1/3] Use krun_set_env to set env vars If we're not setting a command line with krun_set_exec(), use the newly introduced krun_set_env() to set some basic environment variables. Signed-off-by: Sergio Lopez --- src/bindings.rs | 1 + src/start.rs | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bindings.rs b/src/bindings.rs index 60bc1f1..69d1b4f 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -17,5 +17,6 @@ extern "C" { argv: *const *const i8, envp: *const *const i8, ) -> i32; + pub fn krun_set_env(ctx: u32, envp: *const *const i8) -> i32; pub fn krun_start_enter(ctx: u32) -> i32; } diff --git a/src/start.rs b/src/start.rs index 5f6a1bb..5780b4d 100644 --- a/src/start.rs +++ b/src/start.rs @@ -111,6 +111,16 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: Option<&str>, args: Vec = Vec::new(); for a in args.iter() { @@ -118,16 +128,6 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: Option<&str>, args: Vec, args: Vec Date: Thu, 4 Aug 2022 19:57:31 +0200 Subject: [PATCH 2/3] Avoid overriding PATH Since libkrun's init/init.c is able to read the environment variables for the config file, avoid setting it through the library, as it would override the value. Signed-off-by: Sergio Lopez --- src/start.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/start.rs b/src/start.rs index 5780b4d..4da23ca 100644 --- a/src/start.rs +++ b/src/start.rs @@ -113,11 +113,9 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: Option<&str>, args: Vec Date: Thu, 4 Aug 2022 21:16:21 +0200 Subject: [PATCH 3/3] Bump version to v0.2.0 This version includes changes in the behavior, bump minor number to v0.2.0. Signed-off-by: Sergio Lopez --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19009f3..11d012b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,7 +161,7 @@ dependencies = [ [[package]] name = "krunvm" -version = "0.1.6" +version = "0.2.0" dependencies = [ "clap", "confy", diff --git a/Cargo.toml b/Cargo.toml index b13a04e..4039f28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "krunvm" -version = "0.1.6" +version = "0.2.0" authors = ["Sergio Lopez "] description = "Create microVMs from OCI images" repository = "https://github.com/containers/krunvm"