]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: relax rules on CopyFiles= a bit
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Sep 2023 14:44:45 +0000 (16:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Oct 2023 17:11:49 +0000 (19:11 +0200)
If a source dir doesn't exist, mention this, but continue.

This is useful to permit generic definitions that apply to all kinds of
trees, where some parts might remain unpopulated.

src/partition/repart.c

index a38950c7142e2f92fd20c5d6320eeb24ca632d30..51706c839a3415166b017063cf6cc9ac2273fabd 100644 (file)
@@ -4498,6 +4498,10 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
                         return r;
 
                 sfd = chase_and_open(*source, arg_copy_source, CHASE_PREFIX_ROOT, O_CLOEXEC|O_NOCTTY, NULL);
+                if (sfd == -ENOENT) {
+                        log_notice_errno(sfd, "Failed to open source file '%s%s', skipping: %m", strempty(arg_copy_source), *source);
+                        continue;
+                }
                 if (sfd < 0)
                         return log_error_errno(sfd, "Failed to open source file '%s%s': %m", strempty(arg_copy_source), *source);