mirror of
https://github.com/certbot/certbot.git
synced 2026-06-11 09:40:41 -04:00
not running the letsencrypt-auto script as root, but use su if sudo not found
This commit is contained in:
parent
275f083a33
commit
8bad8de1c6
1 changed files with 9 additions and 8 deletions
|
|
@ -14,15 +14,16 @@ VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
|
|||
VENV_BIN=${VENV_PATH}/bin
|
||||
|
||||
if test "`id -u`" -ne "0" ; then
|
||||
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[*]}"
|
||||
if ! type sudo &>/dev/null; then
|
||||
function sudo (){
|
||||
args=("$@")
|
||||
for i in "${!args[@]}"; do
|
||||
args[$i]="'$(printf "%s" "${args[$i]}" | sed -e "s/'/'\"'\"'/g")' "
|
||||
done
|
||||
su root -c "${args[*]}"
|
||||
}
|
||||
fi
|
||||
SUDO=sudo
|
||||
else
|
||||
SUDO=
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue