certbot/letsencrypt-auto-source/pieces/bootstrappers/rpm_python3_legacy.sh

57 lines
1.8 KiB
Bash
Raw Permalink Normal View History

2019-07-25 06:20:33 -04:00
# If new packages are installed by BootstrapRpmPython3 below, this version
# number must be increased.
BOOTSTRAP_RPM_PYTHON3_LEGACY_VERSION=1
2019-09-17 15:55:04 -04:00
EnablePython36SCL() {
set +e
# Do nothing if Python 3.6 is already available
2019-09-18 14:01:42 -04:00
"$EXISTS" python3.6 > /dev/null 2> /dev/null && set -e && return
2019-09-17 15:55:04 -04:00
# Do nothing if SCL Python 3.6 is not installed
2019-09-18 14:01:42 -04:00
! scl --list 2>/dev/null | grep -q rh-python36 && set -e && return
# Enable SCL rh-python36
. scl_source enable rh-python36 && set -e
2019-09-17 15:55:04 -04:00
}
2019-07-25 06:20:33 -04:00
BootstrapRpmPython3Legacy() {
2019-07-25 08:56:31 -04:00
# Tested with:
# - CentOS 6
2019-07-25 06:20:33 -04:00
InitializeRPMCommonBase
2019-07-30 04:16:22 -04:00
if ! "${TOOL}" list rh-python36 >/dev/null 2>&1; then
echo "To use Certbot on this operating system, packages from the SCL repository need to be installed."
if ! "${TOOL}" list centos-release-scl >/dev/null 2>&1; then
2019-07-25 06:20:33 -04:00
error "Enable the SCL repository and try running Certbot again."
exit 1
fi
2019-07-30 04:16:22 -04:00
if [ "${ASSUME_YES}" = 1 ]; then
/bin/echo -n "Enabling the SCL repository in 3 seconds... (Press Ctrl-C to cancel)"
2019-07-25 06:20:33 -04:00
sleep 1s
2019-07-30 04:16:22 -04:00
/bin/echo -ne "\e[0K\rEnabling the SCL repository in 2 seconds... (Press Ctrl-C to cancel)"
2019-07-25 06:20:33 -04:00
sleep 1s
2019-07-30 04:16:22 -04:00
/bin/echo -e "\e[0K\rEnabling the SCL repository in 1 second... (Press Ctrl-C to cancel)"
2019-07-25 06:20:33 -04:00
sleep 1s
fi
2019-07-30 04:16:22 -04:00
if ! "${TOOL}" install "${YES_FLAG}" "${QUIET_FLAG}" centos-release-scl; then
2019-07-25 06:20:33 -04:00
error "Could not enable SCL. Aborting bootstrap!"
exit 1
fi
fi
# CentOS 6 must use rh-python36 from SCL
2019-07-30 04:16:22 -04:00
if "${TOOL}" list rh-python36 >/dev/null 2>&1; then
2019-07-25 08:56:31 -04:00
python_pkgs="rh-python36-python
rh-python36-python-virtualenv
rh-python36-python-devel
2019-07-25 06:20:33 -04:00
"
else
error "No supported Python package available to install. Aborting bootstrap!"
exit 1
fi
2019-09-10 16:40:15 -04:00
BootstrapRpmCommonBase "${python_pkgs}"
2019-09-17 15:55:04 -04:00
# Enable SCL rh-python36 after bootstrapping.
2019-09-10 11:35:42 -04:00
EnablePython36SCL
2019-07-25 06:20:33 -04:00
}