Skip to content

Commit 218fbdb

Browse files
committed
incus: add device removal
1 parent 919b420 commit 218fbdb

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

vuinputd/src/container_runtime/injection_strategy.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,28 @@ impl InjectionStrategy for Incus {
296296
async fn remove_device_node(
297297
&self,
298298
_requesting_process: &RequestingProcess,
299-
_devname: &str,
299+
devname: &str,
300300
_major: u64,
301301
_minor: u64,
302302
) -> anyhow::Result<()> {
303+
let container_name = get_scope();
304+
let container_name = match container_name {
305+
global_config::Scope::Multi => bail!("no container name given"),
306+
global_config::Scope::Single(container_name) => container_name,
307+
};
308+
let child = std::process::Command::new("/usr/bin/incus")
309+
.args([
310+
"config",
311+
"device",
312+
"remove",
313+
container_name,
314+
devname,
315+
])
316+
.spawn()?;
317+
let output = child.wait_with_output()?;
318+
let stdout = String::from_utf8_lossy(&output.stdout);
319+
let stderr = String::from_utf8_lossy(&output.stderr);
320+
println!("incus\n {}\n{}\n", stdout, stderr);
303321
Ok(())
304322
}
305323

0 commit comments

Comments
 (0)