From a6fba858ab3193d692f743700854cfb0fc4a8226 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Dec 2023 18:01:38 +0100 Subject: [PATCH] osbuild: honor `OSBUILD_EXPORT_FORCE_NO_PRESERVE_OWNER` env To workaround the issue that inside macOS containers the ownership cannot be preserved we introduce a new environment that can be used to forcefully relax the use of `cp -a`. I did it via an environment instead of a commandline option mostly because `github.com/osbuild/images/osbuild:RunOBuild()` already has `extraEnv` option. --- osbuild/main_cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osbuild/main_cli.py b/osbuild/main_cli.py index 29a23286..81459470 100644 --- a/osbuild/main_cli.py +++ b/osbuild/main_cli.py @@ -52,8 +52,10 @@ def export(name_or_id, output_directory, store, manifest): obj = store.get(pipeline.id) dest = os.path.join(output_directory, name_or_id) + skip_preserve_owner = \ + os.getenv("OSBUILD_EXPORT_FORCE_NO_PRESERVE_OWNER") == "1" os.makedirs(dest, exist_ok=True) - obj.export(dest) + obj.export(dest, skip_preserve_owner=skip_preserve_owner) def parse_arguments(sys_argv):