]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Put .profile section values in quotes if not alphanumeric
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 7 Oct 2024 10:38:12 +0000 (12:38 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 7 Oct 2024 10:46:50 +0000 (12:46 +0200)
This is supposed to be sourcable by shells so make sure we use
quotes in case values with whitespace are used.

mkosi/__init__.py

index 7436a1eda7e95da1f97750162dd6b8e3b7b67917..28bc118456b56152a18338ecca90aebaf404c29d 100644 (file)
@@ -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}'"):