qemush : finalement la fonction exec_as était utile oups

This commit is contained in:
Hippolyte Chauvin 2023-11-29 14:48:24 +01:00
parent 21643ed7f8
commit 651f52d7a1

View file

@ -1,10 +1,18 @@
#!/bin/bash
if [ "$(whoami)" != root ]; then
exec sudo -u qemu "$0" "$@"
else
exec_as() {
local user
user="$1"
shift
if [ "$(whoami)" != "$user" ]; then
exec sudo -u "$user" "$0" "$@"
else
cd || exit
fi
fi
}
exec_as qemu "$@"
bin=bin
images=images