prepare-root: If composefs is configured as "maybe" don't fail
authorEric Curtin <ecurtin@redhat.com>
Thu, 24 Aug 2023 14:20:25 +0000 (15:20 +0100)
committerEric Curtin <ecurtin@redhat.com>
Thu, 24 Aug 2023 14:20:25 +0000 (15:20 +0100)
If composefs is configured as "maybe", we should continue even if
composefs support is not built in.

src/switchroot/ostree-prepare-root.c

index 62ea56171b7a6e2cafccd72f5bd0e82207367552..54a55c1dc45a57a041eb1aaf5c82e34472abe7a7 100644 (file)
@@ -424,11 +424,11 @@ main (int argc, char *argv[])
   // Tracks if we did successfully enable it at runtime
   bool using_composefs = false;
 
+#ifdef HAVE_COMPOSEFS
   /* We construct the new sysroot in /sysroot.tmp, which is either the composfs
      mount or a bind mount of the deploy-dir */
   if (composefs_config->enabled != OT_TRISTATE_NO)
     {
-#ifdef HAVE_COMPOSEFS
       const char *objdirs[] = { "/sysroot/ostree/repo/objects" };
       g_autofree char *cfs_digest = NULL;
       struct lcfs_mount_options_s cfs_options = {
@@ -532,10 +532,12 @@ main (int argc, char *argv[])
               errx (EXIT_FAILURE, "composefs: failed to mount: %s", errmsg);
             }
         }
+    }
 #else
-      errx (EXIT_FAILURE, "composefs: enabled at runtime, but support is not compiled in");
+  /* if composefs is configured as "maybe", we should continue */
+  if (composefs_config->enabled == OT_TRISTATE_YES)
+    errx (EXIT_FAILURE, "composefs: enabled at runtime, but support is not compiled in");
 #endif
-    }
 
   if (!using_composefs)
     {