Skip to content

Commit 9169b7d

Browse files
alyssarosenzweigslp
authored andcommitted
Allow fex-emu config to fail
These dirs may not exist depending how fex-emu was installed. Signed-off-by: Alyssa Rosenzweig <[email protected]>
1 parent a339cb4 commit 9169b7d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

crates/krun/src/guest/mount.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ fn mount_fex_rootfs() -> Result<()> {
8080
// and a Config.json telling FEX to use FUSE. Neither should be visible to the guest. Instead,
8181
// we want to replace the folders and tell FEX to use our mounted rootfs
8282
for base in ["/usr/share/fex-emu", "/usr/local/share/fex-emu"] {
83-
let json = format!("{{\"Config\":{{\"RootFS\":\"{dir_rootfs}\"}}}}\n");
84-
let path = base.to_string() + "/Config.json";
83+
if Path::new(base).exists() {
84+
let json = format!("{{\"Config\":{{\"RootFS\":\"{dir_rootfs}\"}}}}\n");
85+
let path = base.to_string() + "/Config.json";
8586

86-
make_tmpfs(base)?;
87-
File::create(Path::new(&path))?.write_all(json.as_bytes())?;
87+
make_tmpfs(base)?;
88+
File::create(Path::new(&path))?.write_all(json.as_bytes())?;
89+
}
8890
}
8991

9092
Ok(())

0 commit comments

Comments
 (0)