Add logic

This commit is contained in:
Adrien Ferrand 2019-07-25 12:20:33 +02:00
parent 40da709792
commit ee18ee1664
3 changed files with 51 additions and 8 deletions

View file

@ -298,6 +298,7 @@ DeterminePythonVersion() {
{{ bootstrappers/deb_common.sh }}
{{ bootstrappers/rpm_common_base.sh }}
{{ bootstrappers/rpm_common.sh }}
{{ bootstrappers/rpm_python3_legacy.sh }}
{{ bootstrappers/rpm_python3.sh }}
{{ bootstrappers/suse_common.sh }}
{{ bootstrappers/arch_common.sh }}
@ -336,7 +337,14 @@ elif [ -f /etc/redhat-release ]; then
if [ "$RPM_DIST_NAME" = "fedora" ]; then
RPM_DIST_VERSION=`(. /etc/os-release 2> /dev/null && echo $VERSION_ID) || echo "0"`
fi
if [ "$RPM_DIST_NAME" = "fedora" -a "$RPM_DIST_VERSION" -ge 29 -o "$PYVER" -eq 26 ]; then
if [ "$PYVER" -eq 26 ]; then
Bootstrap() {
BootstrapMessage "Legacy RedHat-based OSes that will use Python3"
BootstrapRpmPython3Legacy
}
USE_PYTHON_3=1
BOOTSTRAP_VERSION="BootstrapRpmPython3Legacy $BOOTSTRAP_RPM_PYTHON3_LEGACY_VERSION"
elif [ "$RPM_DIST_NAME" = "fedora" -a "$RPM_DIST_VERSION" -ge 29 -o "$PYVER" -eq 26 ]; then
Bootstrap() {
BootstrapMessage "RedHat-based OSes that will use Python3"
BootstrapRpmPython3

View file

@ -4,7 +4,6 @@ BOOTSTRAP_RPM_PYTHON3_VERSION=1
BootstrapRpmPython3() {
# Tested with:
# - CentOS 6
# - Fedora 29
InitializeRPMCommonBase
@ -15,12 +14,6 @@ BootstrapRpmPython3() {
python3-virtualenv
python3-devel
"
# EPEL uses python34
elif $TOOL list python34 >/dev/null 2>&1; then
python_pkgs="python34
python34-devel
python34-tools
"
else
error "No supported Python package available to install. Aborting bootstrap!"
exit 1

View file

@ -0,0 +1,42 @@
# If new packages are installed by BootstrapRpmPython3 below, this version
# number must be increased.
BOOTSTRAP_RPM_PYTHON3_LEGACY_VERSION=1
BootstrapRpmPython3Legacy() {
InitializeRPMCommonBase
if ! $TOOL list rh-python36 >/dev/null 2>&1; then
echo "To use Certbot, packages from the SCL repository need to be installed."
if ! $TOOL list centos-release-scl >/dev/null 2>&1; then
error "Enable the SCL repository and try running Certbot again."
exit 1
fi
if [ "$ASSUME_YES" = 1 ]; then
/bin/echo -n "Enabling the SCL repository in 3 seconds..."
sleep 1s
/bin/echo -ne "\e[0K\rEnabling the SCL repository in 2 seconds..."
sleep 1s
/bin/echo -e "\e[0K\rEnabling the SCL repository in 1 second..."
sleep 1s
fi
if ! $TOOL install $YES_FLAG $QUIET_FLAG centos-release-scl; then
error "Could not enable SCL. Aborting bootstrap!"
exit 1
fi
fi
# CentOS 6 must use rh-python36 from SCL
if $TOOL list python3-virtualenv >/dev/null 2>&1; then
python_pkgs="rh-python36
"
else
error "No supported Python package available to install. Aborting bootstrap!"
exit 1
fi
# Insert the SCL specific path in PATH to resolve the correct virtualenv binary from SCL
PATH="/opt/rh/rh-python36/root/usr/bin:$PATH"
BootstrapRpmCommonBase "$python_pkgs"
}