diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 7d5801c..86fcd37 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -151,11 +151,19 @@ fn main() -> Result<(), Box> { .build()?; // Mount the filesystem - let mountpoint = fsproxy.mount(MountOptions { - no_user_interaction: true, - fs_type: String::new(), - mount_options: String::new(), - })?; + let mountpoint = fsproxy + .mount(MountOptions { + no_user_interaction: true, + fs_type: String::new(), + mount_options: String::new(), + }) + .or_else(|_| { + Ok::(loop { + if let Some(m) = fsproxy.mount_points()?.get(0) { + break m.to_string(); + } + }) + })?; // copy ./base/* over to ./disk Command::new("sh") @@ -373,11 +381,19 @@ fn main() -> Result<(), Box> { .build()?; // Mount the filesystem - let mountpoint = fsproxy.mount(MountOptions { - no_user_interaction: true, - fs_type: String::new(), - mount_options: String::new(), - })?; + let mountpoint = fsproxy + .mount(MountOptions { + no_user_interaction: true, + fs_type: String::new(), + mount_options: String::new(), + }) + .or_else(|_| { + Ok::(loop { + if let Some(m) = fsproxy.mount_points()?.get(0) { + break m.to_string(); + } + }) + })?; // copy the kernel over to ./disk/boot/kernel Command::new("cp")