core-agent-linux/qubes-rpc/qubes.ShowInTerminal
2019-05-11 11:54:24 +02:00

20 righe
407 B
Bash

#!/bin/bash --
set -eu
tmpdir="$(mktemp -d)"
if [[ $tmpdir =~ \" ]]; then
echo 'Error: non admissible character detected in sock path.'
exit 1
fi
sock="$tmpdir/terminal.sock"
xterm -geometry 80x24 -e /bin/sh -c "
until [ -S $sock ]; do sleep 0.1; done || true
exec socat file:/dev/tty,rawer,escape=0x0f UNIX-CONNECT:$sock" &
trap 'rm -rf -- "$tmpdir"' EXIT
socat "UNIX-LISTEN:\"$sock\"" -
wait