core-agent-linux/qubes-rpc/qubes.ShowInTerminal

21 lines
440 B
Plaintext
Raw Normal View History

2019-05-07 14:09:46 +02:00
#!/bin/bash --
set -eu
umask 0077
2019-05-07 14:09:46 +02:00
tmpdir="$(mktemp -d)"
if ! [[ $tmpdir =~ ^/[/A-Za-z0-9._-]+$ ]]; then
echo 'Error: non admissible character detected in sock path.'>&2
exit 1
fi
sock="$tmpdir/terminal.sock"
2019-05-07 14:09:46 +02:00
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