diff --git a/man/repart.d.xml b/man/repart.d.xml index d3a8f6fcea..eac8ae7174 100644 --- a/man/repart.d.xml +++ b/man/repart.d.xml @@ -417,6 +417,9 @@ required for the minimal file system of the specified type (or 4KiB if the minimal size is not known). + This also takes a special meta value empty. If specified this is equivalent + to specifying Label=_empty and NoAuto=1. + This option has no effect if the partition already exists. Similarly to the behaviour of CopyBlocks=, the file system is formatted diff --git a/src/repart/repart.c b/src/repart/repart.c index 76253c4a38..352384bfc0 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -2633,6 +2633,19 @@ static int partition_read_definition(Partition *p, const char *path, const char } } + if (streq_ptr(p->format, "empty")) { + p->format = mfree(p->format); + + if (p->no_auto < 0) + p->no_auto = true; + + if (!p->new_label) { + p->new_label = strdup("_empty"); + if (!p->new_label) + return log_oom(); + } + } + if (p->minimize != MINIMIZE_OFF && !p->format && p->verity != VERITY_HASH) return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL), "Minimize= can only be enabled if Format= or Verity=hash are set.");