From 3b1e3ff762b827a9e617d8e570c391ac24b3f55a Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 18 May 2018 15:24:47 +0100
Subject: [PATCH] wrap: Add --xterm option

With --runtime, this will only work if there is an xterm binary in
the runtime. My com.valvesoftware.SteamRuntime.Platform Flatpak runtime
does contain an xterm.

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

diff --git a/pressure-vessel-wrap b/pressure-vessel-wrap
index f3a8eeb0f..b1f7b43e4 100755
--- a/pressure-vessel-wrap
+++ b/pressure-vessel-wrap
@@ -104,6 +104,7 @@ path=
 runtime=
 tmpdir=
 verbose=
+xterm=
 
 multiarch_tuples=(x86_64-linux-gnu i386-linux-gnu)
 
@@ -149,13 +150,15 @@ usage () {
     echo "                              and augment it with the host"
     echo "                              system's graphics stack."
     echo "--verbose                     Be more verbose."
+    echo "--xterm                       Same as --interactive, but run an"
+    echo "                              xterm in the container."
     echo
 
     exit "$code"
 }
 
 getopt_temp="$(getopt -o '' --long \
-    'freedesktop-app-id:,help,home:,interactive,ld-library-path:,ld-preload:,path:,runtime:,steam-app-id:,verbose' \
+    'freedesktop-app-id:,help,home:,interactive,ld-library-path:,ld-preload:,path:,runtime:,steam-app-id:,verbose,xterm' \
     -n "$me" -- "$@")"
 
 eval set -- "$getopt_temp"
@@ -252,7 +255,9 @@ if [ -n "$verbose" ]; then
     env | sed -e 's/^/\t/' >&2
 fi
 
-if [ -n "$interactive" ]; then
+if [ -n "$xterm" ]; then
+    wrapped_command=(xterm -e bash -i -s "$@")
+elif [ -n "$interactive" ]; then
     exec </dev/tty
     exec >/dev/tty
     exec 2>/dev/tty
-- 
GitLab