qemush : finalement la fonction exec_as était utile oups
This commit is contained in:
parent
21643ed7f8
commit
651f52d7a1
1 changed files with 13 additions and 5 deletions
12
bin/qemush
12
bin/qemush
|
@ -1,10 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$(whoami)" != root ]; then
|
||||
exec sudo -u qemu "$0" "$@"
|
||||
exec_as() {
|
||||
local user
|
||||
user="$1"
|
||||
shift
|
||||
|
||||
if [ "$(whoami)" != "$user" ]; then
|
||||
exec sudo -u "$user" "$0" "$@"
|
||||
else
|
||||
cd || exit
|
||||
fi
|
||||
}
|
||||
|
||||
exec_as qemu "$@"
|
||||
|
||||
bin=bin
|
||||
images=images
|
||||
|
|
Loading…
Reference in a new issue