diff --git a/bin/startvm b/bin/startvm new file mode 100755 index 0000000..1774c05 --- /dev/null +++ b/bin/startvm @@ -0,0 +1,20 @@ +#!/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}" + +vm_name="$1" +shift + +"$vm_name" "$@"