From ab108e17feb232fe85ffd4c932140da404aed67a Mon Sep 17 00:00:00 2001 From: Ludovico de Nittis <ludovico.denittis@collabora.com> Date: Fri, 20 Nov 2020 15:57:30 +0100 Subject: [PATCH] runtime: use the new libcapsule "--remap-link-prefix" option Using the new "--remap-link-prefix" option we can now avoid breaking symlinks because not available under `/run/host`. Fixes: #29 Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com> --- debian/control | 6 +++--- pressure-vessel/runtime.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 4ce5d1819..b302c4437 100644 --- a/debian/control +++ b/debian/control @@ -139,7 +139,7 @@ Architecture: amd64 i386 Multi-Arch: foreign Depends: bubblewrap, - libcapsule-tools-relocatable (>= 0.20200707.0~), + libcapsule-tools-relocatable (>= 0.20201120.0), python3 (>= 3.5) | python3.5, steam-runtime-tools-bin, ${misc:Depends}, @@ -157,7 +157,7 @@ Section: libs Architecture: amd64 Multi-Arch: foreign Depends: - libcapsule-tools-relocatable (>= 0.20200707.0~), + libcapsule-tools-relocatable (>= 0.20201120.0), libsteam-runtime-tools-0-helpers, ${misc:Depends}, ${shlibs:Depends}, @@ -171,7 +171,7 @@ Section: libs Architecture: i386 Multi-Arch: foreign Depends: - libcapsule-tools-relocatable (>= 0.20200707.0~), + libcapsule-tools-relocatable (>= 0.20201120.0), libsteam-runtime-tools-0-helpers, ${misc:Depends}, ${shlibs:Depends}, diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c index d1b5da6ef..8278bca1d 100644 --- a/pressure-vessel/runtime.c +++ b/pressure-vessel/runtime.c @@ -1217,6 +1217,8 @@ pv_runtime_get_capsule_capture_libs (PvRuntime *self, RuntimeArchitecture *arch) { const gchar *ld_library_path; + g_autofree gchar *remap_usr = NULL; + g_autofree gchar *remap_lib = NULL; FlatpakBwrap *ret = pv_bwrap_copy (self->container_access_adverb); /* If we have a custom "LD_LIBRARY_PATH", we want to preserve @@ -1225,10 +1227,21 @@ pv_runtime_get_capsule_capture_libs (PvRuntime *self, if (ld_library_path != NULL) flatpak_bwrap_set_env (ret, "LD_LIBRARY_PATH", ld_library_path, TRUE); + /* Every symlink that starts with exactly /usr/ */ + remap_usr = g_strjoin (NULL, "/usr/", "=", + self->provider_in_container_namespace, + "/usr/", NULL); + + /* Every symlink that starts with /lib, e.g. /lib64 */ + remap_lib = g_strjoin (NULL, "/lib", "=", + self->provider_in_container_namespace, + "/lib", NULL); + flatpak_bwrap_add_args (ret, arch->capsule_capture_libs, "--container", self->container_access, - "--link-target", self->provider_in_container_namespace, + "--remap-link-prefix", remap_usr, + "--remap-link-prefix", remap_lib, "--provider", self->provider_in_current_namespace, NULL); -- GitLab