flatpak_run_setup_usr_links: Add control over the mount point

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2021-01-08 16:01:02 +00:00 committed by Alexander Larsson
parent 90aa6c9b79
commit 3f2eeb6dc8

View File

@ -2936,7 +2936,8 @@ setup_seccomp (FlatpakBwrap *bwrap,
static void
flatpak_run_setup_usr_links (FlatpakBwrap *bwrap,
GFile *runtime_files)
GFile *runtime_files,
const char *sysroot)
{
int i;
@ -2955,10 +2956,22 @@ flatpak_run_setup_usr_links (FlatpakBwrap *bwrap,
if (g_file_query_exists (runtime_subdir, NULL))
{
g_autofree char *link = g_strconcat ("usr", subdir, NULL);
g_autofree char *create = NULL;
if (sysroot != NULL)
create = g_strconcat (sysroot, subdir, NULL);
else
create = g_strdup (subdir);
flatpak_bwrap_add_args (bwrap,
"--symlink", link, subdir,
"--symlink", link, create,
NULL);
}
else
{
g_debug ("%s does not exist",
flatpak_file_get_path_cached (runtime_subdir));
}
}
}
@ -3119,7 +3132,7 @@ flatpak_run_setup_base_argv (FlatpakBwrap *bwrap,
NULL);
}
flatpak_run_setup_usr_links (bwrap, runtime_files);
flatpak_run_setup_usr_links (bwrap, runtime_files, NULL);
add_tzdata_args (bwrap, runtime_files);
@ -3388,7 +3401,7 @@ regenerate_ld_cache (GPtrArray *base_argv_array,
flatpak_bwrap_append_args (bwrap, base_argv_array);
flatpak_run_setup_usr_links (bwrap, runtime_files);
flatpak_run_setup_usr_links (bwrap, runtime_files, NULL);
if (generate_ld_so_conf)
{