1
0
Fork 0
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:
Hippolyte Chauvin 2023-10-15 11:32:26 +02:00
parent 3d6d5a9ae2
commit 2457abe3d1

20
bin/startvm Executable file
View 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" "$@"