forked from ahurac/dotfiles
Ajout : script startvm
startvm permet de contrôler l'exécution de machines virtuelles en tant que l'utilisateur Unix qemu
This commit is contained in:
parent
3d6d5a9ae2
commit
2457abe3d1
1 changed files with 20 additions and 0 deletions
20
bin/startvm
Executable file
20
bin/startvm
Executable file
|
@ -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" "$@"
|
Loading…
Reference in a new issue