Let --no-self-upgrade bootstrap OS packages. Fix #2432.

--no-self-upgrade metamorphosed from a private flag to a public one, so add a new private flag, --le-auto-phase2 to take its original role of marking the division between phases. This flag must come first and, consequently, can be stripped off the arg list before calling through to letsencrypt, which means the client doesn't need to know about it.

The downside is that anyone still (deprecatedly) running le-auto out of the root of a (recently updated) master checkout will get a "Hey, the current release version le-auto I just self-upgraded to doesn't understand the --le-auto-phase2 flag" error from when we merge this until the next release is made, but that's better than a documented option not working right.

Also, remove a needless folder creation from the Dockerfile.
This commit is contained in:
Erik Rose
2016-02-11 18:03:01 -05:00
parent 27b0cb0c4d
commit 6eb2d60166
3 changed files with 58 additions and 50 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ RUN apt-get update && \
apt-get clean apt-get clean
RUN pip install nose RUN pip install nose
RUN mkdir -p /home/lea/letsencrypt/letsencrypt RUN mkdir -p /home/lea/letsencrypt
# Install fake testing CA: # Install fake testing CA:
COPY ./tests/certs/ca/my-root-ca.crt.pem /usr/local/share/ca-certificates/ COPY ./tests/certs/ca/my-root-ca.crt.pem /usr/local/share/ca-certificates/
+8 -4
View File
@@ -19,7 +19,7 @@ XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share}
VENV_NAME="letsencrypt" VENV_NAME="letsencrypt"
VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"} VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
VENV_BIN=${VENV_PATH}/bin VENV_BIN=${VENV_PATH}/bin
LE_AUTO_VERSION="0.4.0" LE_AUTO_VERSION="0.5.0.dev0"
# This script takes the same arguments as the main letsencrypt program, but it # This script takes the same arguments as the main letsencrypt program, but it
# additionally responds to --verbose (more output) and --debug (allow support # additionally responds to --verbose (more output) and --debug (allow support
@@ -412,9 +412,10 @@ TempDir() {
if [ "$NO_SELF_UPGRADE" = 1 ]; then if [ "$1" = "--le-auto-phase2" ]; then
# Phase 2: Create venv, install LE, and run. # Phase 2: Create venv, install LE, and run.
shift 1 # the --le-auto-phase2 arg
if [ -f "$VENV_BIN/letsencrypt" ]; then if [ -f "$VENV_BIN/letsencrypt" ]; then
INSTALLED_VERSION=$("$VENV_BIN/letsencrypt" --version 2>&1 | cut -d " " -f 2) INSTALLED_VERSION=$("$VENV_BIN/letsencrypt" --version 2>&1 | cut -d " " -f 2)
else else
@@ -1653,6 +1654,7 @@ else
exit 0 exit 0
fi fi
if [ "$NO_SELF_UPGRADE" != 1 ]; then
echo "Checking for new version..." echo "Checking for new version..."
TEMP_DIR=$(TempDir) TEMP_DIR=$(TempDir)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -1804,6 +1806,8 @@ UNLIKELY_EOF
$SUDO cp "$TEMP_DIR/letsencrypt-auto" "$0" $SUDO cp "$TEMP_DIR/letsencrypt-auto" "$0"
# TODO: Clean up temp dir safely, even if it has quotes in its path. # TODO: Clean up temp dir safely, even if it has quotes in its path.
rm -rf "$TEMP_DIR" rm -rf "$TEMP_DIR"
fi # should upgrade fi # A newer version is available.
"$0" --no-self-upgrade "$@" fi # Self-upgrading is allowed.
"$0" --le-auto-phase2 "$@"
fi fi
@@ -168,9 +168,10 @@ TempDir() {
if [ "$NO_SELF_UPGRADE" = 1 ]; then if [ "$1" = "--le-auto-phase2" ]; then
# Phase 2: Create venv, install LE, and run. # Phase 2: Create venv, install LE, and run.
shift 1 # the --le-auto-phase2 arg
if [ -f "$VENV_BIN/letsencrypt" ]; then if [ -f "$VENV_BIN/letsencrypt" ]; then
INSTALLED_VERSION=$("$VENV_BIN/letsencrypt" --version 2>&1 | cut -d " " -f 2) INSTALLED_VERSION=$("$VENV_BIN/letsencrypt" --version 2>&1 | cut -d " " -f 2)
else else
@@ -230,6 +231,7 @@ else
exit 0 exit 0
fi fi
if [ "$NO_SELF_UPGRADE" != 1 ]; then
echo "Checking for new version..." echo "Checking for new version..."
TEMP_DIR=$(TempDir) TEMP_DIR=$(TempDir)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -255,6 +257,8 @@ UNLIKELY_EOF
$SUDO cp "$TEMP_DIR/letsencrypt-auto" "$0" $SUDO cp "$TEMP_DIR/letsencrypt-auto" "$0"
# TODO: Clean up temp dir safely, even if it has quotes in its path. # TODO: Clean up temp dir safely, even if it has quotes in its path.
rm -rf "$TEMP_DIR" rm -rf "$TEMP_DIR"
fi # should upgrade fi # A newer version is available.
"$0" --no-self-upgrade "$@" fi # Self-upgrading is allowed.
"$0" --le-auto-phase2 "$@"
fi fi