Added vatsim-win

This commit is contained in:
David Thurstenson 2021-04-08 15:48:17 -05:00
parent 7abb171389
commit 9952d04056
1 changed files with 55 additions and 0 deletions

55
bin/vatsim-win Executable file
View File

@ -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[@]}" &