mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 00:35:03 +02:00
Implement a sunset mechanism in certbot-auto for systems not supported anymore (#7587)
* Sunset mechanism * Simplify code * Update letsencrypt-auto-source/letsencrypt-auto.template Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * Update template * Deprecate for all RHEL/CentOS 6 32bits flavors * Add a wrapper to uname to do tests on fake 32 bits versions * Replace all occurences * Add some tests about sunset mechanism * Update letsencrypt-auto-source/tests/centos6_tests.sh Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * Update letsencrypt-auto-source/tests/centos6_tests.sh Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * Various corrections * Recreate script * Update comment position * Test also install only * Fix docker * Update letsencrypt-auto-source/tests/centos6_tests.sh Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * What error command is doing here ? * Fix permissions * Rebuild script * Add changelog * Update letsencrypt-auto-source/letsencrypt-auto.template Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * Update changelog * Trigger CI * Handle old venv path * Modify test * Fix test error detection from subpaths * Edit echo * Use set -e * Update letsencrypt-auto-source/letsencrypt-auto.template Co-Authored-By: Brad Warren <bmw@users.noreply.github.com> * Corrections Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
This commit is contained in:
co-authored by
Brad Warren
parent
fda655370a
commit
84c1b912d9
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
# Start by making sure your system is up-to-date:
|
||||
yum update -y > /dev/null
|
||||
yum install -y centos-release-scl > /dev/null
|
||||
@@ -6,46 +7,51 @@ yum install -y python27 > /dev/null 2> /dev/null
|
||||
|
||||
LE_AUTO="certbot/letsencrypt-auto-source/letsencrypt-auto"
|
||||
|
||||
echo ""
|
||||
|
||||
# we're going to modify env variables, so do this in a subshell
|
||||
(
|
||||
# ensure CentOS6 32bits is not supported anymore, and so certbot is not installed
|
||||
export UNAME_FAKE_32BITS=true
|
||||
if ! "$LE_AUTO" 2>&1 | grep -q "Certbot cannot be installed."; then
|
||||
echo "On CentOS 32 bits, certbot-auto installed certbot."
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
echo "PASSED: On CentOS 6 32 bits, certbot-auto refused to install certbot."
|
||||
|
||||
# we're going to modify env variables, so do this in a subshell
|
||||
(
|
||||
source /opt/rh/python27/enable
|
||||
|
||||
# ensure python 3 isn't installed
|
||||
python3 --version 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "Python3 is already installed."
|
||||
if python3 --version 2> /dev/null; then
|
||||
echo "Python3 is already installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure python2.7 is available
|
||||
python2.7 --version 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
error "Python3 is not available."
|
||||
if ! python2.7 --version 2> /dev/null; then
|
||||
echo "Python2.7 is not available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# bootstrap, but don't install python 3.
|
||||
"$LE_AUTO" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
"$LE_AUTO" --no-self-upgrade -n --version > /dev/null 2> /dev/null
|
||||
|
||||
# ensure python 3 isn't installed
|
||||
python3 --version 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "letsencrypt-auto installed Python3 even though Python2.7 is present."
|
||||
if python3 --version 2> /dev/null; then
|
||||
echo "letsencrypt-auto installed Python3 even though Python2.7 is present."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "PASSED: Did not upgrade to Python3 when Python2.7 is present."
|
||||
)
|
||||
|
||||
echo "PASSED: Did not upgrade to Python3 when Python2.7 is present."
|
||||
|
||||
# ensure python2.7 isn't available
|
||||
python2.7 --version 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "Python2.7 is still available."
|
||||
if python2.7 --version 2> /dev/null; then
|
||||
echo "Python2.7 is still available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -56,13 +62,11 @@ if ! "$LE_AUTO" 2>&1 | grep -q "WARNING: couldn't find Python"; then
|
||||
fi
|
||||
|
||||
# bootstrap, this time installing python3
|
||||
"$LE_AUTO" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
"$LE_AUTO" --no-self-upgrade -n --version > /dev/null 2> /dev/null
|
||||
|
||||
# ensure python 3 is installed
|
||||
python3 --version > /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
error "letsencrypt-auto failed to install Python3 when only Python2.6 is present."
|
||||
if ! python3 --version > /dev/null; then
|
||||
echo "letsencrypt-auto failed to install Python3 when only Python2.6 is present."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -77,5 +81,39 @@ if [ "$($VENV_PATH/bin/python -V 2>&1 | cut -d" " -f2 | cut -d. -f1)" != 3 ]; th
|
||||
fi
|
||||
unset VENV_PATH
|
||||
|
||||
# we're going to modify env variables, so do this in a subshell
|
||||
(
|
||||
# ensure CentOS6 32bits is not supported anymore, and so certbot
|
||||
# is not upgraded nor reinstalled.
|
||||
export UNAME_FAKE_32BITS=true
|
||||
set -o pipefail
|
||||
if ! "$LE_AUTO" --version 2>&1 | grep -q "Certbot will no longer receive updates."; then
|
||||
echo "On CentOS 6 32 bits, certbot-auto failed or upgraded installed certbot instance."
|
||||
exit 1
|
||||
fi
|
||||
set +o pipefail
|
||||
if ! "$LE_AUTO" --install-only 2>&1 | grep -q "Certbot cannot be installed."; then
|
||||
echo "On CentOS 6 32 bits, certbot-auto installed certbot again."
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
# we're going to modify env variables, so do this in a subshell
|
||||
(
|
||||
# Prepare a certbot installation in the old venv path
|
||||
rm -rf /opt/eff.org
|
||||
VENV_PATH=~/.local/share/letsencrypt "$LE_AUTO" --install-only > /dev/null 2> /dev/null
|
||||
# fake 32 bits mode
|
||||
export UNAME_FAKE_32BITS=true
|
||||
set -o pipefail
|
||||
if ! "$LE_AUTO" --version 2>&1 | grep -q "Certbot will no longer receive updates."; then
|
||||
echo "On CentOS 6 32 bits, certbot-auto failed or upgraded installed certbot in the old venv path."
|
||||
exit 1
|
||||
fi
|
||||
set +o pipefail
|
||||
)
|
||||
|
||||
echo "PASSED: On CentOS 6 32 bits, certbot-auto refused to install/upgrade certbot."
|
||||
|
||||
# test using python3
|
||||
pytest -v -s certbot/letsencrypt-auto-source/tests
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
uname_output=$(/bin/uname_orig "$@")
|
||||
|
||||
if [ "$UNAME_FAKE_32BITS" = true ]; then
|
||||
uname_output="${uname_output//x86_64/i686}"
|
||||
fi
|
||||
|
||||
echo "$uname_output"
|
||||
Reference in New Issue
Block a user