Use su if sudo is not available, this fixes #1148

This commit is contained in:
Dev & Sec
2015-11-02 00:55:29 +00:00
parent 66838c9887
commit 275f083a33
+9 -1
View File
@@ -14,7 +14,15 @@ VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
VENV_BIN=${VENV_PATH}/bin
if test "`id -u`" -ne "0" ; then
SUDO=sudo
if type sudo &>/dev/null; then
SUDO=sudo
else
args=("$@")
for i in "${!args[@]}"; do
args[$i]="'$(printf "%s" "${args[$i]}" | sed -e "s/'/'\"'\"'/g")' "
done
exec su root -c "$0 ${args[*]}"
fi
else
SUDO=
fi