From eae5979921176379d1d7195fcf5a323ea9978d82 Mon Sep 17 00:00:00 2001
From: Erin <erin@erindesu.cz>
Date: Fri, 23 Dec 2022 22:55:38 +0100
Subject: [PATCH] but 558fc6da592fa7e16ac8418f0e229cc7817a9451 breaks systems
 witzh automount! now both should work.

---
 repbuild/src/main.rs | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

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<dyn std::error::Error>> {
                         .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::<String, zbus::Error>(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<dyn std::error::Error>> {
                         .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::<String, zbus::Error>(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")