mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 16:15:42 +02:00
Use su if sudo is not available, this fixes #1148
This commit is contained in:
+9
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user