21 lines
231 B
Text
21 lines
231 B
Text
|
#!/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" "$@"
|