From 9952d040568d3f8bbbf494e4188badceaefc76cc Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 8 Apr 2021 15:48:17 -0500 Subject: [PATCH] Added vatsim-win --- bin/vatsim-win | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 bin/vatsim-win diff --git a/bin/vatsim-win b/bin/vatsim-win new file mode 100755 index 0000000..5e329b7 --- /dev/null +++ b/bin/vatsim-win @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +#vatsim-win: virt-viewer launcher + +declare -A cmdstring +declare -A uri +declare -a opts + +cmdstring=([domain]="vatsim-ame" + [startcmd]="virsh start ${cmdstring[domain]}") + +uri=([remote]="qemu+ssh://lark-desktop/system" + [remotespice]="spice://10.10.0.106:5900" + [local]="qemu:///system") + + +case "$(uname -n)" in + lark-desktop) + cmdstring+=([cmd]="virt-viewer" + [uri]=${uri[local]} + [manuri]=${uri[local]} + [fullstartcmd]=${cmdstring[startcmd]}) + opts=("--connect=${cmdstring[uri]}" + "--wait" + "--reconnect" + "--direct" + "${cmdstring[domain]}") + ;; + *) + cmdstring+=([cmd]="remote-viewer" + [uri]=${uri[remotespice]} + [manuri]=${uri[remote]} + [fullstartcmd]="ssh lark-desktop ${cmdstring[startcmd]}") + opts=("${cmdstring[uri]}") + ;; +esac + +while :; do + case $1 in + -m) + cmdstring+=([cmd]="virt-manager") + opts=("--connect=${cmdstring[manuri]}" + "--show-domain-editor" + "${cmdstring[domain]}") + ;; + *) break;; + esac + shift +done + +if grep "${cmdstring[domain]}" <(virsh list --state-shutoff --name); then + ${cmdstring[fullstartcmd]} +fi + +${cmdstring[cmd]} "${opts[@]}" &