23 lines
735 B
Bash
Executable File
23 lines
735 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 /etc/qubes-rpc/admin.vm.Console" --service --dispvm="$DISPVM" -- qubes.ShowInTerminal
|