repart: Default to vfat for ESP/XBOOTLDR partitions

vfat makes a lot more sense than ext4 for these partitions.
This commit is contained in:
Daan De Meyer 2023-05-22 19:32:18 +02:00
parent 4539bb3b4b
commit ab45e83fb6
2 changed files with 8 additions and 7 deletions

View File

@ -409,11 +409,12 @@
directories from the host into the file system that is created due to the <varname>Format=</varname>
option. If <varname>CopyFiles=</varname> is used without <varname>Format=</varname> specified
explicitly, <literal>Format=</literal> with a suitable default is implied (currently
<literal>ext4</literal>, but this may change in the future). This option may be used multiple times
to copy multiple files or directories from host into the newly formatted file system. The colon and
second path may be omitted in which case the source path is also used as the target path (relative to
the root of the newly created file system). If the source path refers to a directory it is copied
recursively.</para>
<literal>vfat</literal> for <literal>ESP</literal> and <literal>XBOOTLDR</literal> partitions, and
<literal>ext4</literal> otherwise, but this may change in the future). This option may be used
multiple times to copy multiple files or directories from host into the newly formatted file system.
The colon and second path may be omitted in which case the source path is also used as the target
path (relative to the root of the newly created file system). If the source path refers to a
directory it is copied recursively.</para>
<para>This option has no effect if the partition already exists: it cannot be used to copy additional
files into an existing partition, it may only be used to populate a file system created anew.</para>

View File

@ -1673,8 +1673,8 @@ static int partition_read_definition(Partition *p, const char *path, const char
"Format=swap and CopyFiles= cannot be combined, refusing.");
if (!p->format && (!strv_isempty(p->copy_files) || !strv_isempty(p->make_directories) || (p->encrypt != ENCRYPT_OFF && !(p->copy_blocks_path || p->copy_blocks_auto)))) {
/* Pick "ext4" as file system if we are configured to copy files or encrypt the device */
p->format = strdup("ext4");
/* Pick "vfat" as file system for esp and xbootldr partitions, otherwise default to "ext4". */
p->format = strdup(IN_SET(p->type.designator, PARTITION_ESP, PARTITION_XBOOTLDR) ? "vfat" : "ext4");
if (!p->format)
return log_oom();
}