bin/bin/kd-win

48 lines
877 B
Bash
Executable File

#!/usr/bin/env bash
#kd-win: virt-viewer launcher
declare -A cmdstring
declare -A uri
declare -a opts
cmdstring[domain]="win10"
uri=([remote]="qemu+ssh://kd-laptop/system"
[remotespice]="spice://10.10.0.14"
[local]="qemu:///system")
case "$(uname -n)" in
kd-laptop)
cmdstring=([cmd]="virt-viewer"
[uri]=${uri[local]}
[manuri]=${uri[local]})
opts=("--connect=${cmdstring[uri]}"
"--wait"
"--reconnect"
"--direct"
"${cmdstring[domain]}")
;;
*)
cmdstring=([cmd]="remote-viewer"
[uri]=${uri[remotespice]}
[manuri]=${uri[remote]})
opts=("${cmdstring[uri]}")
;;
esac
while :; do
case $1 in
-m)
cmdstring=([cmd]="virt-manager")
opts=("--connect=${cmdstring[manuri]}"
"--show-domain-editor")
;;
*) break;;
esac
shift
done
${cmdstring[cmd]} "${opts[@]}" &