From: Daan De Meyer Date: Wed, 12 Oct 2022 12:53:48 +0000 (+0200) Subject: repart: Fail early if no sources are provided for a read-only filesystem X-Git-Tag: v253-rc1~520^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eb23798d5e8ad52d4a17e2de5f27b70a4f5b43b;p=thirdparty%2Fsystemd.git repart: Fail early if no sources are provided for a read-only filesystem --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 494a3100b78..4e309ab214e 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -1599,6 +1599,10 @@ static int partition_read_definition(Partition *p, const char *path, const char "Need to be root to populate %s filesystems with CopyFiles=/MakeDirectories=", p->format); + if (p->format && fstype_is_ro(p->format) && strv_isempty(p->copy_files) && strv_isempty(p->make_directories)) + return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL), + "Cannot format %s filesystem without source files, refusing", p->format); + if (p->verity != VERITY_OFF || p->encrypt != ENCRYPT_OFF) { r = dlopen_cryptsetup(); if (r < 0)