From 6df5c7c348db31d36aa7854ee4bbb14d30978025 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 18 May 2018 15:21:41 +0100
Subject: [PATCH] wrap: Add pressure-vessel's bin directory to PATH

In particular you can place a custom bwrap here for testing.

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

diff --git a/pressure-vessel-wrap b/pressure-vessel-wrap
index 6db1305f7..0b531a291 100755
--- a/pressure-vessel-wrap
+++ b/pressure-vessel-wrap
@@ -35,6 +35,8 @@ me="$(readlink -f "$0")"
 here="${me%/*}"
 me="${me##*/}"
 
+default_path="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
+
 # Undo any weird environment before we start running external
 # executables. We put it back before running the actual app/game.
 
@@ -53,12 +55,11 @@ if { [ -n "${LD_LIBRARY_PATH-}" ] && \
     fi
 
     caller_path="${PATH:-"${default_path}"}"
-    default_path="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
 
     if [ -n "${SYSTEM_PATH-}" ]; then
-        export PATH="$SYSTEM_PATH"
+        export PATH="$here:$SYSTEM_PATH"
     else
-        export PATH="$default_path"
+        export PATH="$here:$default_path"
     fi
 
     if [ -n "$caller_ld_preload" ]; then
@@ -259,6 +260,8 @@ if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then
     fi
     if [ -n "$path" ]; then
         export PATH="$path"
+    else
+        export PATH="$default_path"
     fi
     if [ -n "$ld_library_path" ]; then
         export LD_LIBRARY_PATH="$ld_library_path"
@@ -732,6 +735,8 @@ else
 fi
 if [ -n "$path" ]; then
     bwrap_options+=(--setenv PATH "$path")
+else
+    bwrap_options+=(--setenv PATH "$default_path")
 fi
 
 if "$BWRAP" --help | grep unshare-uts >/dev/null; then
-- 
GitLab