mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 00:22:28 +02:00
Ensure apt-cache is always running in English if we're going to grep its output (#3900)
This commit is contained in:
committed by
Brad Warren
parent
e6f24db624
commit
2d7f6d7d92
@@ -15,9 +15,13 @@ set -e # Work even if somebody does "sh thisscript.sh".
|
|||||||
|
|
||||||
# Note: you can set XDG_DATA_HOME or VENV_PATH before running this script,
|
# Note: you can set XDG_DATA_HOME or VENV_PATH before running this script,
|
||||||
# if you want to change where the virtual environment will be installed
|
# if you want to change where the virtual environment will be installed
|
||||||
XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share}
|
if [ -z "$XDG_DATA_HOME" ]; then
|
||||||
|
XDG_DATA_HOME="~/.local/share"
|
||||||
|
fi
|
||||||
VENV_NAME="letsencrypt"
|
VENV_NAME="letsencrypt"
|
||||||
VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
|
if [ -z "$VENV_PATH" ]; then
|
||||||
|
VENV_PATH="$XDG_DATA_HOME/$VENV_NAME"
|
||||||
|
fi
|
||||||
VENV_BIN="$VENV_PATH/bin"
|
VENV_BIN="$VENV_PATH/bin"
|
||||||
LE_AUTO_VERSION="0.10.0.dev0"
|
LE_AUTO_VERSION="0.10.0.dev0"
|
||||||
BASENAME=$(basename $0)
|
BASENAME=$(basename $0)
|
||||||
@@ -80,6 +84,17 @@ if [ $BASENAME = "letsencrypt-auto" ]; then
|
|||||||
HELP=0
|
HELP=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Support for busybox and others where there is no "command",
|
||||||
|
# but "which" instead
|
||||||
|
if command -v command > /dev/null 2>&1 ; then
|
||||||
|
export EXISTS="command -v"
|
||||||
|
elif which which > /dev/null 2>&1 ; then
|
||||||
|
export EXISTS="which"
|
||||||
|
else
|
||||||
|
echo "Cannot find command nor which... please install one!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# certbot-auto needs root access to bootstrap OS dependencies, and
|
# certbot-auto needs root access to bootstrap OS dependencies, and
|
||||||
# certbot itself needs root access for almost all modes of operation
|
# certbot itself needs root access for almost all modes of operation
|
||||||
# The "normal" case is that sudo is used for the steps that need root, but
|
# The "normal" case is that sudo is used for the steps that need root, but
|
||||||
@@ -127,7 +142,7 @@ if [ -n "${LE_AUTO_SUDO+x}" ]; then
|
|||||||
echo "Using preset root authorization mechanism '$LE_AUTO_SUDO'."
|
echo "Using preset root authorization mechanism '$LE_AUTO_SUDO'."
|
||||||
else
|
else
|
||||||
if test "`id -u`" -ne "0" ; then
|
if test "`id -u`" -ne "0" ; then
|
||||||
if command -v sudo 1>/dev/null 2>&1; then
|
if $EXISTS sudo 1>/dev/null 2>&1; then
|
||||||
SUDO=sudo
|
SUDO=sudo
|
||||||
SUDO_ENV="CERTBOT_AUTO=$0"
|
SUDO_ENV="CERTBOT_AUTO=$0"
|
||||||
else
|
else
|
||||||
@@ -157,7 +172,7 @@ ExperimentalBootstrap() {
|
|||||||
DeterminePythonVersion() {
|
DeterminePythonVersion() {
|
||||||
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
for LE_PYTHON in "$LE_PYTHON" python2.7 python27 python2 python; do
|
||||||
# Break (while keeping the LE_PYTHON value) if found.
|
# Break (while keeping the LE_PYTHON value) if found.
|
||||||
command -v "$LE_PYTHON" > /dev/null && break
|
$EXISTS "$LE_PYTHON" > /dev/null && break
|
||||||
done
|
done
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Cannot find any Pythons; please install one!"
|
echo "Cannot find any Pythons; please install one!"
|
||||||
@@ -198,19 +213,22 @@ BootstrapDebCommon() {
|
|||||||
# distro version (#346)
|
# distro version (#346)
|
||||||
|
|
||||||
virtualenv=
|
virtualenv=
|
||||||
if apt-cache show virtualenv > /dev/null 2>&1 && ! apt-cache --quiet=0 show virtualenv 2>&1 | grep -q 'No packages found'; then
|
# virtual env is known to apt and is installable
|
||||||
virtualenv="virtualenv"
|
if apt-cache show virtualenv > /dev/null 2>&1 ; then
|
||||||
|
if ! LC_ALL=C apt-cache --quiet=0 show virtualenv 2>&1 | grep -q 'No packages found'; then
|
||||||
|
virtualenv="virtualenv"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if apt-cache show python-virtualenv > /dev/null 2>&1; then
|
if apt-cache show python-virtualenv > /dev/null 2>&1; then
|
||||||
virtualenv="$virtualenv python-virtualenv"
|
virtualenv="$virtualenv python-virtualenv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
augeas_pkg="libaugeas0 augeas-lenses"
|
augeas_pkg="libaugeas0 augeas-lenses"
|
||||||
AUGVERSION=`apt-cache show --no-all-versions libaugeas0 | grep ^Version: | cut -d" " -f2`
|
AUGVERSION=`LC_ALL=C apt-cache show --no-all-versions libaugeas0 | grep ^Version: | cut -d" " -f2`
|
||||||
|
|
||||||
if [ "$ASSUME_YES" = 1 ]; then
|
if [ "$ASSUME_YES" = 1 ]; then
|
||||||
YES_FLAG="-y"
|
YES_FLAG="-y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AddBackportRepo() {
|
AddBackportRepo() {
|
||||||
@@ -276,7 +294,7 @@ BootstrapDebCommon() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ! command -v virtualenv > /dev/null ; then
|
if ! $EXISTS virtualenv > /dev/null ; then
|
||||||
echo Failed to install a working \"virtualenv\" command, exiting
|
echo Failed to install a working \"virtualenv\" command, exiting
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -960,7 +978,28 @@ UNLIKELY_EOF
|
|||||||
# Report error. (Otherwise, be quiet.)
|
# Report error. (Otherwise, be quiet.)
|
||||||
echo "Had a problem while installing Python packages."
|
echo "Had a problem while installing Python packages."
|
||||||
if [ "$VERBOSE" != 1 ]; then
|
if [ "$VERBOSE" != 1 ]; then
|
||||||
|
echo
|
||||||
|
echo "pip prints the following errors: "
|
||||||
|
echo "====================================================="
|
||||||
echo "$PIP_OUT"
|
echo "$PIP_OUT"
|
||||||
|
echo "====================================================="
|
||||||
|
echo
|
||||||
|
echo "Certbot has problem setting up the virtual environment."
|
||||||
|
|
||||||
|
if `echo $PIP_OUT | grep -q Killed` || `echo $PIP_OUT | grep -q "allocate memory"` ; then
|
||||||
|
echo
|
||||||
|
echo "Based on your pip output, the problem can likely be fixed by "
|
||||||
|
echo "increasing the available memory."
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "We were not be able to guess the right solution from your pip "
|
||||||
|
echo "output."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment"
|
||||||
|
echo "for possible solutions."
|
||||||
|
echo "You may also find some support resources at https://certbot.eff.org/support/ ."
|
||||||
fi
|
fi
|
||||||
rm -rf "$VENV_PATH"
|
rm -rf "$VENV_PATH"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -23,19 +23,22 @@ BootstrapDebCommon() {
|
|||||||
# distro version (#346)
|
# distro version (#346)
|
||||||
|
|
||||||
virtualenv=
|
virtualenv=
|
||||||
if apt-cache show virtualenv > /dev/null 2>&1 && ! apt-cache --quiet=0 show virtualenv 2>&1 | grep -q 'No packages found'; then
|
# virtual env is known to apt and is installable
|
||||||
virtualenv="virtualenv"
|
if apt-cache show virtualenv > /dev/null 2>&1 ; then
|
||||||
|
if ! LC_ALL=C apt-cache --quiet=0 show virtualenv 2>&1 | grep -q 'No packages found'; then
|
||||||
|
virtualenv="virtualenv"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if apt-cache show python-virtualenv > /dev/null 2>&1; then
|
if apt-cache show python-virtualenv > /dev/null 2>&1; then
|
||||||
virtualenv="$virtualenv python-virtualenv"
|
virtualenv="$virtualenv python-virtualenv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
augeas_pkg="libaugeas0 augeas-lenses"
|
augeas_pkg="libaugeas0 augeas-lenses"
|
||||||
AUGVERSION=`apt-cache show --no-all-versions libaugeas0 | grep ^Version: | cut -d" " -f2`
|
AUGVERSION=`LC_ALL=C apt-cache show --no-all-versions libaugeas0 | grep ^Version: | cut -d" " -f2`
|
||||||
|
|
||||||
if [ "$ASSUME_YES" = 1 ]; then
|
if [ "$ASSUME_YES" = 1 ]; then
|
||||||
YES_FLAG="-y"
|
YES_FLAG="-y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AddBackportRepo() {
|
AddBackportRepo() {
|
||||||
|
|||||||
Reference in New Issue
Block a user