diff --git a/bin/qemush b/bin/qemush new file mode 100755 index 0000000..b716638 --- /dev/null +++ b/bin/qemush @@ -0,0 +1,99 @@ +#!/bin/bash + +exec_as() { + local user="$1" + shift + + if [ "$(whoami)" != "$user" ]; then + exec sudo -u "$user" "$0" "$@" + else + cd + fi +} + +exec_as qemu "$@" || exit +PATH="./bin:${PATH}" + +perror() { + >&2 printf '\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*" +} + +public_help() { + local name + name="$(basename "$0")" + cat << EOF +${name}: usage: + ${name} active - (default behaviour) list active VMs + ${name} start - start a VM + ${name} watch - attach VM screen session + ${name} list - list available VMs + ${name} add