From b56c9a0fb4e27d1253951554a83b976be1f3a168 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 19 Feb 2021 12:32:16 +0000
Subject: [PATCH] wrap: Automatically enable --copy-runtime if running under
 Flatpak

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/wrap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index fda9ca640..fbe9436dc 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -1007,7 +1007,7 @@ static GOptionEntry options[] =
   { "no-copy-runtime", '\0',
     G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_copy_runtime,
     "Don't behave as described for --copy-runtime. "
-    "[Default unless $PRESSURE_VESSEL_COPY_RUNTIME is 1]",
+    "[Default unless $PRESSURE_VESSEL_COPY_RUNTIME is 1 or running in Flatpak]",
     NULL },
   { "copy-runtime-into", '\0',
     G_OPTION_FLAG_FILENAME|G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK,
@@ -1312,6 +1312,9 @@ main (int argc,
 
   original_environ = g_get_environ ();
 
+  if (is_flatpak_env)
+    opt_copy_runtime = TRUE;
+
   /* Set defaults */
   opt_batch = pv_boolean_environment ("PRESSURE_VESSEL_BATCH", FALSE);
   /* Process COPY_RUNTIME_INFO first so that COPY_RUNTIME and VARIABLE_DIR
-- 
GitLab