From 0b5f53f6b4c9475aebd2c4dae7a80d4851f96789 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 24 Nov 2020 13:21:49 +0000
Subject: [PATCH] pressure-vessel-wrap: Add environment variables to share
 filesystems

This provides a generic way to get OS-specific library directories,
Vulkan layers' configuration, etc. into the container.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/wrap.1.md | 11 +++++++++++
 pressure-vessel/wrap.c    |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/pressure-vessel/wrap.1.md b/pressure-vessel/wrap.1.md
index 96400f30d..f8e00213f 100644
--- a/pressure-vessel/wrap.1.md
+++ b/pressure-vessel/wrap.1.md
@@ -210,6 +210,17 @@ The following environment variables (among others) are read by
 :   Equivalent to
     `--copy-runtime-into="$PRESSURE_VESSEL_COPY_RUNTIME_INTO"`.
 
+`PRESSURE_VESSEL_FILESYSTEMS_RO` (`:`-separated list of paths)
+:   Make these paths available read-only inside the container if they
+    exist, similar to `--filesystem` but read-only.
+    For example, MangoHUD and vkBasalt users might use
+    `PRESSURE_VESSEL_FILESYSTEMS_RO="$MANGOHUD_CONFIGFILE:$VKBASALT_CONFIG_FILE"`
+    if the configuration files are outside the home directory.
+
+`PRESSURE_VESSEL_FILESYSTEMS_RW` (`:`-separated list of paths)
+:   Make these paths available read/write inside the container if they
+    exist, similar to `--filesystem`.
+
 `PRESSURE_VESSEL_FDO_APP_ID` (string)
 :   Equivalent to
     `--freedesktop-app-id="$PRESSURE_VESSEL_FDO_APP_ID"`.
diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index c520cde55..bd0281eb3 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -373,6 +373,9 @@ typedef struct
 
 static const EnvMount known_required_env[] =
 {
+    { "PRESSURE_VESSEL_FILESYSTEMS_RO",
+      ENV_MOUNT_FLAGS_READ_ONLY | ENV_MOUNT_FLAGS_COLON_DELIMITED },
+    { "PRESSURE_VESSEL_FILESYSTEMS_RW", ENV_MOUNT_FLAGS_COLON_DELIMITED },
     { "STEAM_COMPAT_APP_LIBRARY_PATH", ENV_MOUNT_FLAGS_DEPRECATED },
     { "STEAM_COMPAT_APP_LIBRARY_PATHS",
       ENV_MOUNT_FLAGS_COLON_DELIMITED | ENV_MOUNT_FLAGS_DEPRECATED },
-- 
GitLab