mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:52:02 +02:00
Merge pull request #3062 from certbot/remove-temp-dir
Always remove temporary directories in le-auto
This commit is contained in:
@@ -425,7 +425,8 @@ BootstrapMac() {
|
|||||||
|
|
||||||
$pkgcmd augeas
|
$pkgcmd augeas
|
||||||
$pkgcmd dialog
|
$pkgcmd dialog
|
||||||
if [ "$(which python)" = "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python" ]; then
|
if [ "$(which python)" = "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python" \
|
||||||
|
-o "$(which python)" = "/usr/bin/python" ]; then
|
||||||
# We want to avoid using the system Python because it requires root to use pip.
|
# We want to avoid using the system Python because it requires root to use pip.
|
||||||
# python.org, MacPorts or HomeBrew Python installations should all be OK.
|
# python.org, MacPorts or HomeBrew Python installations should all be OK.
|
||||||
echo "Installing python..."
|
echo "Installing python..."
|
||||||
@@ -531,6 +532,7 @@ if [ "$1" = "--le-auto-phase2" ]; then
|
|||||||
|
|
||||||
echo "Installing Python packages..."
|
echo "Installing Python packages..."
|
||||||
TEMP_DIR=$(TempDir)
|
TEMP_DIR=$(TempDir)
|
||||||
|
trap 'rm -rf "$TEMP_DIR"' EXIT
|
||||||
# There is no $ interpolation due to quotes on starting heredoc delimiter.
|
# There is no $ interpolation due to quotes on starting heredoc delimiter.
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
cat << "UNLIKELY_EOF" > "$TEMP_DIR/letsencrypt-auto-requirements.txt"
|
cat << "UNLIKELY_EOF" > "$TEMP_DIR/letsencrypt-auto-requirements.txt"
|
||||||
@@ -888,7 +890,6 @@ UNLIKELY_EOF
|
|||||||
PIP_OUT=`"$VENV_BIN/pip" install --no-cache-dir --require-hashes -r "$TEMP_DIR/letsencrypt-auto-requirements.txt" 2>&1`
|
PIP_OUT=`"$VENV_BIN/pip" install --no-cache-dir --require-hashes -r "$TEMP_DIR/letsencrypt-auto-requirements.txt" 2>&1`
|
||||||
PIP_STATUS=$?
|
PIP_STATUS=$?
|
||||||
set -e
|
set -e
|
||||||
rm -rf "$TEMP_DIR"
|
|
||||||
if [ "$PIP_STATUS" != 0 ]; then
|
if [ "$PIP_STATUS" != 0 ]; then
|
||||||
# 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:"
|
||||||
@@ -934,6 +935,7 @@ else
|
|||||||
|
|
||||||
if [ "$NO_SELF_UPGRADE" != 1 ]; then
|
if [ "$NO_SELF_UPGRADE" != 1 ]; then
|
||||||
TEMP_DIR=$(TempDir)
|
TEMP_DIR=$(TempDir)
|
||||||
|
trap 'rm -rf "$TEMP_DIR"' EXIT
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
cat << "UNLIKELY_EOF" > "$TEMP_DIR/fetch.py"
|
cat << "UNLIKELY_EOF" > "$TEMP_DIR/fetch.py"
|
||||||
"""Do downloading and JSON parsing without additional dependencies. ::
|
"""Do downloading and JSON parsing without additional dependencies. ::
|
||||||
@@ -1088,8 +1090,6 @@ UNLIKELY_EOF
|
|||||||
# filesystems is non-atomic, doing `rm dest, cp src dest, rm src`, but the
|
# filesystems is non-atomic, doing `rm dest, cp src dest, rm src`, but the
|
||||||
# cp is unlikely to fail (esp. under sudo) if the rm doesn't.
|
# cp is unlikely to fail (esp. under sudo) if the rm doesn't.
|
||||||
$SUDO mv -f "$TEMP_DIR/letsencrypt-auto.permission-clone" "$0"
|
$SUDO mv -f "$TEMP_DIR/letsencrypt-auto.permission-clone" "$0"
|
||||||
# TODO: Clean up temp dir safely, even if it has quotes in its path.
|
|
||||||
rm -rf "$TEMP_DIR"
|
|
||||||
fi # A newer version is available.
|
fi # A newer version is available.
|
||||||
fi # Self-upgrading is allowed.
|
fi # Self-upgrading is allowed.
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ if [ "$1" = "--le-auto-phase2" ]; then
|
|||||||
|
|
||||||
echo "Installing Python packages..."
|
echo "Installing Python packages..."
|
||||||
TEMP_DIR=$(TempDir)
|
TEMP_DIR=$(TempDir)
|
||||||
|
trap 'rm -rf "$TEMP_DIR"' EXIT
|
||||||
# There is no $ interpolation due to quotes on starting heredoc delimiter.
|
# There is no $ interpolation due to quotes on starting heredoc delimiter.
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
cat << "UNLIKELY_EOF" > "$TEMP_DIR/letsencrypt-auto-requirements.txt"
|
cat << "UNLIKELY_EOF" > "$TEMP_DIR/letsencrypt-auto-requirements.txt"
|
||||||
@@ -245,7 +246,6 @@ UNLIKELY_EOF
|
|||||||
PIP_OUT=`"$VENV_BIN/pip" install --no-cache-dir --require-hashes -r "$TEMP_DIR/letsencrypt-auto-requirements.txt" 2>&1`
|
PIP_OUT=`"$VENV_BIN/pip" install --no-cache-dir --require-hashes -r "$TEMP_DIR/letsencrypt-auto-requirements.txt" 2>&1`
|
||||||
PIP_STATUS=$?
|
PIP_STATUS=$?
|
||||||
set -e
|
set -e
|
||||||
rm -rf "$TEMP_DIR"
|
|
||||||
if [ "$PIP_STATUS" != 0 ]; then
|
if [ "$PIP_STATUS" != 0 ]; then
|
||||||
# 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:"
|
||||||
@@ -291,6 +291,7 @@ else
|
|||||||
|
|
||||||
if [ "$NO_SELF_UPGRADE" != 1 ]; then
|
if [ "$NO_SELF_UPGRADE" != 1 ]; then
|
||||||
TEMP_DIR=$(TempDir)
|
TEMP_DIR=$(TempDir)
|
||||||
|
trap 'rm -rf "$TEMP_DIR"' EXIT
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
cat << "UNLIKELY_EOF" > "$TEMP_DIR/fetch.py"
|
cat << "UNLIKELY_EOF" > "$TEMP_DIR/fetch.py"
|
||||||
{{ fetch.py }}
|
{{ fetch.py }}
|
||||||
@@ -319,8 +320,6 @@ UNLIKELY_EOF
|
|||||||
# filesystems is non-atomic, doing `rm dest, cp src dest, rm src`, but the
|
# filesystems is non-atomic, doing `rm dest, cp src dest, rm src`, but the
|
||||||
# cp is unlikely to fail (esp. under sudo) if the rm doesn't.
|
# cp is unlikely to fail (esp. under sudo) if the rm doesn't.
|
||||||
$SUDO mv -f "$TEMP_DIR/letsencrypt-auto.permission-clone" "$0"
|
$SUDO mv -f "$TEMP_DIR/letsencrypt-auto.permission-clone" "$0"
|
||||||
# TODO: Clean up temp dir safely, even if it has quotes in its path.
|
|
||||||
rm -rf "$TEMP_DIR"
|
|
||||||
fi # A newer version is available.
|
fi # A newer version is available.
|
||||||
fi # Self-upgrading is allowed.
|
fi # Self-upgrading is allowed.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user