mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 13:59:02 -04:00
Do not assume sudo is present
- On Digital Ocean and perhaps other platforms, the user is root by default and sudo is uninstalled
This commit is contained in:
parent
ecd987b8ca
commit
39e489d03c
1 changed files with 12 additions and 6 deletions
|
|
@ -10,6 +10,12 @@ VENV_NAME="letsencrypt"
|
|||
VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
|
||||
VENV_BIN=${VENV_PATH}/bin
|
||||
|
||||
if test "`id -u`" -ne "0" ; then
|
||||
SUDO=sudo
|
||||
else
|
||||
SUDO=
|
||||
fi
|
||||
|
||||
for arg in "$@" ; do
|
||||
# This first clause is redundant with the third, but hedging on portability
|
||||
if [ "$arg" = "-v" ] || [ "$arg" = "--verbose" ] || echo "$arg" | grep -E -- -v+ ; then
|
||||
|
|
@ -28,16 +34,16 @@ then
|
|||
fi
|
||||
if [ -f /etc/debian_version ] ; then
|
||||
echo "Bootstrapping dependencies for Debian-based OSes..."
|
||||
sudo $BOOTSTRAP/_deb_common.sh
|
||||
$SUDO $BOOTSTRAP/_deb_common.sh
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
echo "Bootstrapping dependencies for Archlinux..."
|
||||
sudo $BOOTSTRAP/archlinux.sh
|
||||
$SUDO $BOOTSTRAP/archlinux.sh
|
||||
elif [ -f /etc/redhat-release ] ; then
|
||||
echo "Bootstrapping dependencies for RedHat-based OSes..."
|
||||
sudo $BOOTSTRAP/_rpm_common.sh
|
||||
$SUDO $BOOTSTRAP/_rpm_common.sh
|
||||
elif uname | grep -iq FreeBSD ; then
|
||||
echo "Bootstrapping dependencies for FreeBSD..."
|
||||
sudo $BOOTSTRAP/freebsd.sh
|
||||
$SUDO $BOOTSTRAP/freebsd.sh
|
||||
elif uname | grep -iq Darwin ; then
|
||||
echo "Bootstrapping dependencies for Mac OS X..."
|
||||
echo "WARNING: Mac support is very experimental at present..."
|
||||
|
|
@ -71,5 +77,5 @@ fi
|
|||
|
||||
# Explain what's about to happen, for the benefit of those getting sudo
|
||||
# password prompts...
|
||||
echo "Running with virtualenv:" sudo $VENV_BIN/letsencrypt "$@"
|
||||
sudo $VENV_BIN/letsencrypt $@
|
||||
echo "Running with virtualenv:" $SUDO $VENV_BIN/letsencrypt "$@"
|
||||
$SUDO $VENV_BIN/letsencrypt $@
|
||||
|
|
|
|||
Loading…
Reference in a new issue