From: Daan De Meyer Date: Mon, 11 Mar 2024 16:33:57 +0000 (+0100) Subject: Handle symlink explicitly in finalize_staging() X-Git-Tag: v22~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb070d403d9ab75b1ff22dbeb2b32b828c6aaf8f;p=thirdparty%2Fmkosi.git Handle symlink explicitly in finalize_staging() move_tree() doesn't handle symlinks so add some special casing for the symlink we create in the staging directory. Fixes #2479 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 659d1f00f..4c35cbe35 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3195,6 +3195,12 @@ def finalize_staging(context: Context) -> None: # Make sure all build outputs that are not directories are owned by the user running mkosi. if not f.is_dir(): os.chown(f, INVOKING_USER.uid, INVOKING_USER.gid, follow_symlinks=False) + + if f.is_symlink(): + (context.config.output_dir_or_cwd() / f.name).symlink_to(f.readlink()) + os.chown(f, INVOKING_USER.uid, INVOKING_USER.gid, follow_symlinks=False) + continue + move_tree( f, context.config.output_dir_or_cwd(), use_subvolumes=context.config.use_subvolumes,