core-admin/qvm-tools/qvm-console-dispvm
Marek Marczykowski-Górecki ad8f1b06b4
Add missing source admin.vm.Console call in qvm-console-dispvm
Qrexec service called manually needs both source and destination

Fixes QubesOS/qubes-issues#5362
2019-10-09 04:41:48 +02:00

23 lines
761 B
Bash
Executable File

#!/bin/bash
print_usage() {
cat >&2 << USAGE
Usage: $0 vmname
Connects to VM console throught DispVM using the qubes.ShowInTerminal RPC service.
USAGE
}
if [ $# -lt 1 ]; then
print_usage
exit 1
fi
QREXEC_REQUESTED_TARGET="$1"
qvm-check --quiet --running "$QREXEC_REQUESTED_TARGET" > /dev/null 2>&1 || { echo "Error: domain '$QREXEC_REQUESTED_TARGET' does not exist or is not running"; exit 1; }
DISPVM="$(qvm-prefs "$QREXEC_REQUESTED_TARGET" management_dispvm)"
[[ "x$DISPVM" == "x" ]] && { echo "Error: cannot determine management DispVM to use"; exit 1; }
sudo qvm-run -p --localcmd="QREXEC_REQUESTED_TARGET=$QREXEC_REQUESTED_TARGET QREXEC_REMOTE_DOMAIN=dom0 /etc/qubes-rpc/admin.vm.Console" --service --dispvm="$DISPVM" -- qubes.ShowInTerminal