]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: make CopyBlock=auto work for verity sig partitions 37688/head
authorLennart Poettering <lennart@poettering.net>
Mon, 2 Jun 2025 04:43:09 +0000 (06:43 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 Jun 2025 04:45:09 +0000 (06:45 +0200)
Note that this doesn't care which partition set (A or B in an A/B
scenario) is actually newer, it just picks the first suitable, but
that's something we should look into later. For now, let's just make
verity sig partitions work the same way as verity partitions.

Fixes #34835

src/repart/repart.c

index 71d456254ea34065568d8e2565c2f25955cfe4b0..3f8b24158b586a30db1f6b6ecad32f9782ce7858 100644 (file)
@@ -7291,23 +7291,34 @@ static int resolve_copy_blocks_auto(
          * partitions in the host, using the appropriate directory as key and ensuring that the partition
          * type matches. */
 
-        if (type.designator == PARTITION_ROOT)
-                try1 = "/";
-        else if (type.designator == PARTITION_USR)
-                try1 = "/usr/";
-        else if (type.designator == PARTITION_ROOT_VERITY)
+        switch (type.designator) {
+
+        case PARTITION_ROOT:
+        case PARTITION_ROOT_VERITY:
+        case PARTITION_ROOT_VERITY_SIG:
                 try1 = "/";
-        else if (type.designator == PARTITION_USR_VERITY)
+                break;
+
+        case PARTITION_USR:
+        case PARTITION_USR_VERITY:
+        case PARTITION_USR_VERITY_SIG:
                 try1 = "/usr/";
-        else if (type.designator == PARTITION_ESP) {
+                break;
+
+        case PARTITION_ESP:
                 try1 = "/efi/";
                 try2 = "/boot/";
-        } else if (type.designator == PARTITION_XBOOTLDR)
+                break;
+
+        case PARTITION_XBOOTLDR:
                 try1 = "/boot/";
-        else
+                break;
+
+        default:
                 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
                                        "Partition type " SD_ID128_FORMAT_STR " not supported from automatic source block device discovery.",
                                        SD_ID128_FORMAT_VAL(type.uuid));
+        }
 
         r = find_backing_devno(try1, root, &devno);
         if (r == -ENOENT && try2)