git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/localfs/usr/local/bin/virtmc
blob: 5fee1bbf624510e4f530f30cb3336f50c572ce39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

[ -z "$LIBVIRT_DEFAULT_URI" ]&&CONNURI="qemu:///system"||CONNURI="$LIBVIRT_DEFAULT_URI"
[ -z "$1" ]&&echo "Viciously refusing to connect to the KVM console of the zero pointer." >&2&&exit 1

virtmhelp() {
	echo -e "USAGE:\tvirtmc|virtme|virtmp"
	echo
	(
		echo ";virtmc:;Shows the domain's console screen"
		echo ";virtme:;Shows the domain editor without going to the console screen"
		echo ";virtmp:;Shows the domain's performance"
	)|column -s\; -t --table-right 2
}
[ "$1" == "-h" ]&&virtmhelp&&exit 0

case "$(basename $0)" in
	virtmc) virt-manager -c "$CONNURI" --show-domain-console "$1";;
	virtme) virt-manager -c "$CONNURI" --show-domain-editor "$1";;
	virtmp) virt-manager -c "$CONNURI" --show-domain-performance "$1";;
	*) echo "Fatal exception: do not simply symlink stuff without knowing what you do!" >&2;exit 1;;
esac