exports: Only choose bwrap --bind/--ro-bind for host FS once

We can choose this once and use it repeatedly, which will be simpler
when we add more directories that work this way.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2020-01-20 18:50:07 +00:00
committed by Alexander Larsson
parent fb97782d26
commit b2adbe2a74

View File

@@ -279,14 +279,17 @@ flatpak_exports_append_bwrap_args (FlatpakExports *exports,
if (exports->host_fs != 0)
{
const char *host_bind_mode = "--bind";
if (exports->host_fs == FLATPAK_FILESYSTEM_MODE_READ_ONLY)
host_bind_mode = "--ro-bind";
if (g_file_test ("/usr", G_FILE_TEST_IS_DIR))
flatpak_bwrap_add_args (bwrap,
(exports->host_fs == FLATPAK_FILESYSTEM_MODE_READ_ONLY) ? "--ro-bind" : "--bind",
"/usr", "/run/host/usr", NULL);
host_bind_mode, "/usr", "/run/host/usr", NULL);
if (g_file_test ("/etc", G_FILE_TEST_IS_DIR))
flatpak_bwrap_add_args (bwrap,
(exports->host_fs == FLATPAK_FILESYSTEM_MODE_READ_ONLY) ? "--ro-bind" : "--bind",
"/etc", "/run/host/etc", NULL);
host_bind_mode, "/etc", "/run/host/etc", NULL);
}
}