]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: mangle discovered /usr/ partition data, even if we found a root partition
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Sep 2021 09:12:23 +0000 (11:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Sep 2021 12:15:32 +0000 (14:15 +0200)
Previously, we'd clean up discovered /usr/ partition data only if we did
not find a root partition. Given that we allow combinations of root and
/usr partitions clean things up in both cases however.

src/shared/dissect-image.c

index 480e4a22847af34d1484c18e964344e4bd26b294..00ac8c694075efbf51fcba1c4e8bcf7645432e2f 100644 (file)
@@ -1317,7 +1317,7 @@ int dissect_image(
         } else if (m->partitions[PARTITION_ROOT_SECONDARY_VERITY].found)
                 return -EADDRNOTAVAIL; /* as above */
 
-        else if (m->partitions[PARTITION_USR].found) {
+        if (m->partitions[PARTITION_USR].found) {
 
                 /* Invalidate secondary arch /usr/ if we found the primary arch */
                 m->partitions[PARTITION_USR_SECONDARY].found = false;
@@ -1337,8 +1337,10 @@ int dissect_image(
         } else if (m->partitions[PARTITION_USR_SECONDARY_VERITY].found)
                 return -EADDRNOTAVAIL; /* as above */
 
-        else if ((flags & DISSECT_IMAGE_GENERIC_ROOT) &&
-                 (!verity || !verity->root_hash)) {
+        if (!m->partitions[PARTITION_ROOT].found &&
+            !m->partitions[PARTITION_USR].found &&
+            (flags & DISSECT_IMAGE_GENERIC_ROOT) &&
+            (!verity || !verity->root_hash)) {
 
                 /* OK, we found nothing usable, then check if there's a single generic one distro, and use
                  * that. If the root hash was set however, then we won't fall back to a generic node, because