From: Daan De Meyer Date: Fri, 15 Nov 2024 10:27:09 +0000 (+0100) Subject: Detect home directories outside of /home properly X-Git-Tag: v25~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=613f0c4eb39c90d7dbd38cefa044533bff38af67;p=thirdparty%2Fmkosi.git Detect home directories outside of /home properly Fixes #3191 --- diff --git a/mkosi/util.py b/mkosi/util.py index 82499ea35..ba1a9ab88 100644 --- a/mkosi/util.py +++ b/mkosi/util.py @@ -244,6 +244,9 @@ def current_home_dir() -> Optional[Path]: if Path.cwd().is_relative_to("/root"): return Path("/root") + if (home := os.getenv("HOME")) and Path.cwd().is_relative_to(home): + return Path(home) + if Path.cwd().is_relative_to("/home"): # `Path.parents` only supports slices and negative indexing from Python 3.10 onwards. # TODO: Remove list() when we depend on Python 3.10 or newer.