certbot/letstest/scripts/bootstrap_os_packages.sh

141 lines
2.9 KiB
Bash
Raw Permalink Normal View History

Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
#!/bin/sh
#
# Install OS dependencies for test farm tests.
set -ex # Work even if somebody does "sh thisscript.sh".
error() {
echo "$@"
}
if command -v command > /dev/null 2>&1 ; then
export EXISTS="command -v"
elif which which > /dev/null 2>&1 ; then
export EXISTS="which"
else
error "Cannot find command nor which... please install one!"
exit 1
fi
# Sets LE_PYTHON to Python version string and PYVER to the first two
# digits of the python version.
DeterminePythonVersion() {
# If no Python is found, PYVER is set to 0.
for LE_PYTHON in python3 python2.7 python27 python2 python; do
# Break (while keeping the LE_PYTHON value) if found.
$EXISTS "$LE_PYTHON" > /dev/null && break
done
if [ "$?" != "0" ]; then
PYVER=0
return 0
fi
PYVER=$("$LE_PYTHON" -V 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | sed 's/\.//')
}
BootstrapDebCommon() {
sudo apt-get update || error apt-get update hit problems but continuing anyway...
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
sudo apt-get install -y --no-install-recommends \
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
python3 \
python3-dev \
python3-venv \
gcc \
libaugeas0 \
libssl-dev \
openssl \
libffi-dev \
ca-certificates \
build-essential \
curl \
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
make # needed on debian 9 arm64 which doesn't have a python3 pynacl wheel
# make sure rust isn't installed by the package manager
if ! sudo apt-get remove -y rustc; then
error "Could not remove existing rust. Aborting bootstrap!"
exit 1
fi
# Install rust for cryptography (needed on Debian)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. $HOME/.cargo/env
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
}
# Sets TOOL to the name of the package manager
InitializeRPMCommonBase() {
if type dnf 2>/dev/null
then
TOOL=dnf
elif type yum 2>/dev/null
then
TOOL=yum
else
error "Neither yum nor dnf found. Aborting bootstrap!"
exit 1
fi
}
BootstrapRpmCommonBase() {
# Arguments: whitespace-delimited python packages to install
InitializeRPMCommonBase
pkgs="
gcc
augeas-libs
openssl
openssl-devel
libffi-devel
redhat-rpm-config
ca-certificates
cargo
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
"
# Add the python packages
pkgs="$pkgs
$1
"
if $TOOL list installed "httpd" >/dev/null 2>&1; then
pkgs="$pkgs
mod_ssl
"
fi
if ! sudo $TOOL install -y $pkgs; then
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
error "Could not install OS dependencies. Aborting bootstrap!"
exit 1
fi
}
BootstrapRpmPython3() {
InitializeRPMCommonBase
python_pkgs="python3
python3-devel
"
if ! sudo $TOOL list 'python3*-devel' >/dev/null 2>&1; then
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
fi
BootstrapRpmCommonBase "$python_pkgs"
}
# Set Bootstrap to the function that installs OS dependencies on this system.
if [ -f /etc/debian_version ]; then
Bootstrap() {
BootstrapDebCommon
}
elif [ -f /etc/redhat-release ]; then
DeterminePythonVersion
Bootstrap() {
BootstrapRpmPython3
}
Update test farm tests to stop using certbot-auto (#8207) * Create bootstrap script * Delete a whole bunch of the bootstrap script * modify test_tests to use new script * put python version checking in back in * add x * call the venv creation from inside the bootstrap * add targets back * modify test_apache2 to use new format * shouldn't need virtualenv on rhel * readd targets * Update test_sdists to use new script * move setting up venv back out of script so it's not run with sudo * take venv3.py call out of bootstrap in all scripts * add additional python3-devel pkg name * fix test_sdists * enable additional rhel7 repos * clean up code and comments * Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh * only install python3-devel.x86_64 for rhel7 * Upgrade python version for debian in test_apache2.sh * don't run test_tests or test_sdists on debian 9 or ubuntu 16.04 * Add 20.04 and 20.04 arm images to targets.yaml * use pyenv to upgrade to python3.5 * remove arm64 instance because it's having auth trouble * correct pyenv usage on ubuntu * add arm64 target to targets.yaml * replace debian 9 arm64 with ubuntu 20 * don't try to upgrade a perfectly good python version * let's just add ubuntu20 to apache2_targets while we're here * uncomment test_apache2 * move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition * no need to specify the arch once extra rhel7 repos enabled * explicitly specify python3 * don't fail if we can't enable rhel7 extras * capture python36-devel as well
2020-08-18 13:07:27 -04:00
fi
Bootstrap