Skip to content

Commit 3b2ce57

Browse files
committed
Allow overriding udevd binary path at runtime
Signed-off-by: Val Packett <[email protected]>
1 parent 5f9a75d commit 3b2ce57

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

crates/muvm/src/guest/bin/muvm-guest.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,16 @@ fn main() -> Result<ExitCode> {
7777
rustix::stdio::dup2_stdout(console.as_fd())?;
7878
rustix::stdio::dup2_stderr(console.as_fd())?;
7979

80-
Command::new(std::option_env!("MUVM_UDEVD_PATH").unwrap_or("/usr/lib/systemd/systemd-udevd"))
81-
.spawn()
82-
.context("Running systemd-udevd")?;
80+
const DEFAULT_UDEVD_PATH: &str = match std::option_env!("MUVM_UDEVD_PATH") {
81+
Some(path) => path,
82+
None => "/usr/lib/systemd/systemd-udevd",
83+
};
84+
Command::new(
85+
env::var("MUVM_UDEVD_PATH").unwrap_or_else(|_| DEFAULT_UDEVD_PATH.parse().unwrap()),
86+
)
87+
.spawn()
88+
.context("Failed to execute `systemd-udevd` as a child process")?;
89+
env::remove_var("MUVM_UDEVD_PATH");
8390

8491
if let Some(emulator) = options.emulator {
8592
match emulator {

0 commit comments

Comments
 (0)