Skip to content

Commit

Permalink
context: Generalize handling of special filesystems a bit
Browse files Browse the repository at this point in the history
Currently there are only "home" and "host", but I'm going to add one
that represents /usr and friends (/usr, /lib, ...), and one for /etc.
These differ from ordinary filesystem mounts because they are redirected
into /run/host to avoid conflicting with the runtime.

Signed-off-by: Simon McVittie <smcv@collabora.com>
  • Loading branch information
smcv authored and alexlarsson committed Feb 14, 2020
1 parent 08d65c5 commit 949a3ec
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions common/flatpak-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ const char *flatpak_context_features[] = {
NULL
};

const char *flatpak_context_special_filesystems[] = {
"home",
"host",
NULL
};

FlatpakContext *
flatpak_context_new (void)
{
Expand Down Expand Up @@ -749,9 +755,7 @@ flatpak_context_verify_filesystem (const char *filesystem_and_mode,
{
g_autofree char *filesystem = parse_filesystem_flags (filesystem_and_mode, NULL);

if (strcmp (filesystem, "host") == 0)
return TRUE;
if (strcmp (filesystem, "home") == 0)
if (g_strv_contains (flatpak_context_special_filesystems, filesystem))
return TRUE;
if (get_xdg_user_dir_from_string (filesystem, NULL, NULL, NULL))
return TRUE;
Expand Down Expand Up @@ -2103,8 +2107,7 @@ flatpak_context_export (FlatpakContext *context,
const char *filesystem = key;
FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);

if (strcmp (filesystem, "host") == 0 ||
strcmp (filesystem, "home") == 0)
if (g_strv_contains (flatpak_context_special_filesystems, filesystem))
continue;

if (g_str_has_prefix (filesystem, "xdg-"))
Expand Down

0 comments on commit 949a3ec

Please sign in to comment.