From 47f3ec24405f4ed437c046a7678b5b3a4578ee88 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 1 Feb 2019 18:44:35 +0000
Subject: [PATCH] wrap: Don't fail if more than one dri directory is found

Instead of failing, merge the directories' contents.

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

diff --git a/pressure-vessel-wrap b/pressure-vessel-wrap
index 2d4b65969..9dc601a79 100755
--- a/pressure-vessel-wrap
+++ b/pressure-vessel-wrap
@@ -573,7 +573,7 @@ if [ -n "$runtime" ]; then
 
             for dir in "/lib/$t" "/usr/lib/$t" "$libQUAL" "/usr$libQUAL"; do
                 if [ -d "$dir/dri" ]; then
-                    ln -s "/run/host$dir/dri" "$tmpdir/overrides/lib/$t/dri"
+                    mkdir -p "$tmpdir/overrides/lib/$t/dri"
 
                     "$BWRAP" \
                         --ro-bind / / \
@@ -586,6 +586,13 @@ if [ -n "$runtime" ]; then
                         --dest="$tmpdir/overrides/lib/$t" \
                         --provider="/" \
                         "only-dependencies:path-match:$dir/dri/*"
+                    "$BWRAP" \
+                        --ro-bind / / \
+                        --tmpfs /run \
+                        --ro-bind / /run/host \
+                        --bind "$tmpdir/overrides" "$tmpdir/overrides" \
+                        sh -c 'ln -fns "$1"/* "$2"' \
+                        sh "/run/host$dir/dri" "$tmpdir/overrides/lib/$t/dri"
                 fi
 
                 # S3TC or S2TC support for Mesa
-- 
GitLab