]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Default to vfat for ESP/XBOOTLDR partitions
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 22 May 2023 17:32:18 +0000 (19:32 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 22 May 2023 20:16:32 +0000 (22:16 +0200)
vfat makes a lot more sense than ext4 for these partitions.

man/repart.d.xml
src/partition/repart.c

index 464bbf076d937871cd843f776550ed4627e22190..d272d112da6140b6311f0ecb14c4b73da51e650e 100644 (file)
         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>
index 995a40655d7cfdd80ffd11698b69f11966b56f56..d5d5e2353f28c3e2c808a7500fc6dea219c1c60e 100644 (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();
         }