From: Daan De Meyer Date: Mon, 8 Jan 2024 10:20:52 +0000 (+0100) Subject: sandbox: Only mount host dirs that exist X-Git-Tag: v20~9^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2c4a11e49f6ae8c1073dba95d482d880f7d5c3e;p=thirdparty%2Fmkosi.git sandbox: Only mount host dirs that exist --- diff --git a/mkosi/sandbox.py b/mkosi/sandbox.py index 150a07fd4..2fcfdc10d 100644 --- a/mkosi/sandbox.py +++ b/mkosi/sandbox.py @@ -104,7 +104,8 @@ def sandbox_cmd( dirs = ("/etc", "/opt", "/srv", "/media", "/mnt", "/var", os.fspath(INVOKING_USER.home())) for d in dirs: - cmdline += ["--bind", d, d] + if Path(d).exists(): + cmdline += ["--bind", d, d] # `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.