From: Daan De Meyer Date: Sun, 12 Mar 2023 14:29:57 +0000 (+0100) Subject: Expand regular user if not running as root X-Git-Tag: v15~299^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1383%2Fhead;p=thirdparty%2Fmkosi.git Expand regular user if not running as root --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index cf8bfa266..d747893b3 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3918,6 +3918,8 @@ def expand_paths(paths: Sequence[str]) -> list[Path]: # No os.path.expandvars because it treats unset variables as empty. expanded = [] for path in paths: + if not sudo_user: + path = os.path.expanduser(path) try: expanded += [Path(string.Template(str(path)).substitute(environ))] except KeyError: