From 4b866068909789bb2079cb93d0ecdf242e05f51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 5 May 2019 17:28:17 +0200 Subject: [PATCH] Add qvm-terminal-dispvm --- Makefile | 1 + qvm-tools/qvm-terminal-dispvm | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 qvm-tools/qvm-terminal-dispvm diff --git a/Makefile b/Makefile index beffcd69..7ff89ae0 100644 --- a/Makefile +++ b/Makefile @@ -196,6 +196,7 @@ endif install -m 0755 qvm-tools/qubes-bug-report $(DESTDIR)/usr/bin/qubes-bug-report install -m 0755 qvm-tools/qubes-hcl-report $(DESTDIR)/usr/bin/qubes-hcl-report install -m 0755 qvm-tools/qvm-sync-clock $(DESTDIR)/usr/bin/qvm-sync-clock + install -m 0755 qvm-tools/qvm-terminal-dispvm $(DESTDIR)/usr/bin/qvm-terminal-dispvm for method in $(ADMIN_API_METHODS_SIMPLE); do \ ln -s ../../usr/libexec/qubes/qubesd-query-fast \ $(DESTDIR)/etc/qubes-rpc/$$method || exit 1; \ diff --git a/qvm-tools/qvm-terminal-dispvm b/qvm-tools/qvm-terminal-dispvm new file mode 100755 index 00000000..ec69324a --- /dev/null +++ b/qvm-tools/qvm-terminal-dispvm @@ -0,0 +1,18 @@ +#!/bin/bash +print_usage() { +cat >&2 << USAGE +Usage: $0 vmname +Connects to VM console throught DispVM using the admin.vm.TerminalDispVM RPC service. +USAGE +} + +if [ $# -lt 1 ]; then + print_usage + exit 1 +fi + +QREXEC_REQUESTED_TARGET="$1" + +qvm-check --quiet "$QREXEC_REQUESTED_TARGET" > /dev/null 2>&1 || { echo "Error: no such domain: '$QREXEC_REQUESTED_TARGET'"; exit 1; } + +sudo qvm-run -p --localcmd="QREXEC_REQUESTED_TARGET=$QREXEC_REQUESTED_TARGET /etc/qubes-rpc/admin.vm.Terminal" --service --dispvm="$(qubes-prefs management_dispvm)" -- admin.vm.TerminalDispVM