See that FIXME...
---
 src/update_handler.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/update_handler.c b/src/update_handler.c
index b8d044f..6f490d0 100644
--- a/src/update_handler.c
+++ b/src/update_handler.c
@@ -1,6 +1,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <gio/gunixoutputstream.h>
+#include <glib/gstdio.h>
 #include <mtd/ubi-user.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -251,13 +252,33 @@ static gboolean casync_extract_image(RaucImage *image, 
gchar *dest, GError **err
                 * path to allow seeding. E.g. using mount path '/' for the
                 * rootfs slot seed is inaproppriate as it contains virtual
                 * file systems, additional mounts, etc. */
+               /* FIXME: r_mount_slot should be fixed instead to handle bind 
mounts
+                * as well as "nodev" mounts */
                if (!seedslot->mount_point) {
                        g_debug("Mounting %s to use as seed", seedslot->device);
-                       res = r_mount_slot(seedslot, &ierror);
-                       if (!res) {
-                               g_warning("Failed mounting for seeding: %s", 
ierror->message);
-                               g_clear_error(&ierror);
-                               goto extract;
+                       if (seedslot->ext_mount_point) {
+                               gchar *mount_point = 
r_create_mount_point(seedslot->name, &ierror);
+                               if (!mount_point) {
+                                       g_warning("Failed creating bind mount 
point for seeding: %s", ierror->message);
+                                       g_clear_error(&ierror);
+                                       goto extract;
+                               }
+                               res = r_mount_full(seedslot->ext_mount_point, 
mount_point, NULL, 0, "bind", &ierror);
+                               if (!res) {
+                                       g_warning("Failed bind mounting for 
seeding: %s", ierror->message);
+                                       g_clear_error(&ierror);
+                                       g_rmdir(mount_point);
+                                       g_free(mount_point);
+                                       goto extract;
+                               }
+                               seedslot->mount_point = mount_point;
+                       } else {
+                               res = r_mount_slot(seedslot, &ierror);
+                               if (!res) {
+                                       g_warning("Failed mounting for seeding: 
%s", ierror->message);
+                                       g_clear_error(&ierror);
+                                       goto extract;
+                               }
                        }
                        seed_mounted = TRUE;
                }
-- 
2.20.1


_______________________________________________
RAUC mailing list

Reply via email to