Skip to content

Commit

Permalink
Allow fex-emu config to fail
Browse files Browse the repository at this point in the history
These dirs may not exist depending how fex-emu was installed.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
  • Loading branch information
alyssarosenzweig authored and slp committed Sep 28, 2024
1 parent a339cb4 commit 9169b7d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/krun/src/guest/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ fn mount_fex_rootfs() -> Result<()> {
// and a Config.json telling FEX to use FUSE. Neither should be visible to the guest. Instead,
// we want to replace the folders and tell FEX to use our mounted rootfs
for base in ["/usr/share/fex-emu", "/usr/local/share/fex-emu"] {
let json = format!("{{\"Config\":{{\"RootFS\":\"{dir_rootfs}\"}}}}\n");
let path = base.to_string() + "/Config.json";
if Path::new(base).exists() {
let json = format!("{{\"Config\":{{\"RootFS\":\"{dir_rootfs}\"}}}}\n");
let path = base.to_string() + "/Config.json";

make_tmpfs(base)?;
File::create(Path::new(&path))?.write_all(json.as_bytes())?;
make_tmpfs(base)?;
File::create(Path::new(&path))?.write_all(json.as_bytes())?;
}
}

Ok(())
Expand Down

0 comments on commit 9169b7d

Please sign in to comment.