diff --git a/letsencrypt-auto b/letsencrypt-auto index d163998aa..e14b099a9 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -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