mirror of
https://github.com/systemd/systemd.git
synced 2026-11-06 21:36:59 +00:00
sysupdate: honor default MatchPartitionType= for partitions
sysupdate.d(5) documents linux-generic as the default MatchPartitionType= for partition targets. After10eaca4159, omitting the option left partition_type_set false and update failed before acquiring the image. Reproducer: create a partition target transfer without MatchPartitionType= and run systemd-sysupdate update. Before: update failed with: Partition type must be set for partition targets. After: update succeeds on a linux-generic slot and installs the version, leaving the GPT label as part-v1. Follow-up for:10eaca4159(cherry picked from commita3ab9d2c1a)
This commit is contained in:
1 parent
54652ccf35
commit
4746b8dfd2
1 file changed
+6
-2
@@ -600,6 +600,11 @@ int transfer_read_definition(Transfer *t, const char *path, const char **dirs, H
|
||||
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Target Type= must be one of partition, regular-file, directory, subvolume.");
|
||||
|
||||
if (t->target.type == RESOURCE_PARTITION && !t->target.partition_type_set) {
|
||||
t->target.partition_type = gpt_partition_type_from_uuid(SD_GPT_LINUX_GENERIC);
|
||||
t->target.partition_type_set = true;
|
||||
}
|
||||
|
||||
if ((IN_SET(t->source.type, RESOURCE_URL_FILE, RESOURCE_PARTITION, RESOURCE_REGULAR_FILE) &&
|
||||
!IN_SET(t->target.type, RESOURCE_PARTITION, RESOURCE_REGULAR_FILE)) ||
|
||||
(IN_SET(t->source.type, RESOURCE_URL_TAR, RESOURCE_TAR, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME) &&
|
||||
@@ -1243,8 +1248,7 @@ int transfer_compute_temporary_paths(Transfer *t, Instance *i, InstanceMetadata
|
||||
if (!r)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Formatted pattern is not suitable as GPT partition label, refusing: %s", formatted_pattern);
|
||||
|
||||
if (!t->target.partition_type_set)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Partition type must be set for partition targets.");
|
||||
assert(t->target.partition_type_set);
|
||||
|
||||
/* Derive temporary partition type UUIDs for partial/pending states from the configured
|
||||
* partition type. This avoids the need for label prefixes. */
|
||||
|
||||
Reference in new issue
Block a user