From 2a35f9958bc6b82d95d1eac02dc245e9bb068765 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 7 Oct 2024 12:38:12 +0200 Subject: [PATCH] Put .profile section values in quotes if not alphanumeric This is supposed to be sourcable by shells so make sure we use quotes in case values with whitespace are used. --- mkosi/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 7436a1eda..28bc11845 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2011,6 +2011,9 @@ def build_uki_profiles(context: Context, cmdline: Sequence[str]) -> list[Path]: with profile_section.open("w") as f: for k, v in profile.profile.items(): + if not all(c.isalnum() for c in v): + v = f'"{v}"' + f.write(f"{k}={v}\n") with complete_step(f"Generating UKI profile '{id}'"):