diff options
| author | Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org> | 2026-06-08 21:05:09 +0000 |
|---|---|---|
| committer | Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org> | 2026-06-08 21:05:09 +0000 |
| commit | ea3426bc80aad58e689c144ec6ddee0cda7861cb (patch) | |
| tree | c4e245e90b0254cde31a3dc2d511a0b73f3a88c9 | |
| parent | b16c731b0191d6c47de46a3c6057b0c5ec0dd420 (diff) | |
nuageinit: Create parent directories in write_files
Currently, 'write_files' does not create parent directories, and
'runcmd' cannot be used here, since those scripts run after the files
have been written. The only workaround is to create the files in an
existing directory, such as '/root' or '/tmp', and then move those
files using 'runcmd', but this is cumbersome when there are many files,
even if they are small.
With this change, nuageinit now creates the parent directories for each
file using the path field, which mimics the same behavior as in
cloud-init.
Permissions and ownership can also be configured using 'runcmd'.
Reviewed by: bapt@
Approved by: bapt@
Differential Revision: https://reviews.freebsd.org/D57395
| -rw-r--r-- | libexec/nuageinit/nuage.lua | 1 | ||||
| -rw-r--r-- | libexec/nuageinit/nuageinit.7 | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index a554553b3e61..cbf92627918c 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -832,6 +832,7 @@ local function addfile(file, defer) root = "" end local filepath = root .. file.path + mkdir_p(dirname(filepath)) local f = assert(io.open(filepath, mode)) if content then f:write(content) diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index e1c4b9d61382..a3d9da2415d9 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -3,7 +3,7 @@ .\" Copyright (c) 2025 Baptiste Daroussin <bapt@FreeBSD.org> .\" Copyright (c) 2025 Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org> .\" -.Dd June 6, 2026 +.Dd June 8, 2026 .Dt NUAGEINIT 7 .Os .Sh NAME @@ -615,7 +615,7 @@ and are supported for now. .It Ic path The path of the file to be created. -.Pq Note intermerdiary directories will not be created . +.Pq Note intermerdiary directories will be created . .It Ic permissions A string representing the permission of the file in octal. .It Ic owner |
