From d0231b21298f1bcdc5047ef242257e401e87cdda Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 8 Jan 2021 11:13:39 +0000
Subject: [PATCH] wrap: Exit cleanly if asked to run in Flatpak without a
 mutable copy

We always need a mutable copy of the runtime when running in Flatpak,
because we are unable to run bwrap to do container setup.

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

diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index e0ebff04b..a64bd7010 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -1656,6 +1656,14 @@ main (int argc,
 
       g_debug ("Configuring runtime %s...", opt_runtime);
 
+      if (is_flatpak_env && opt_copy_runtime_into == NULL)
+        {
+          glnx_throw (error,
+                      "Cannot set up a runtime inside Flatpak without "
+                      "making a mutable copy");
+          goto out;
+        }
+
       runtime = pv_runtime_new (opt_runtime,
                                 opt_copy_runtime_into,
                                 bwrap_executable,
-- 
GitLab