Changeset - 40421c0cdad1
[Not reviewed]
0 1 0
Branko Majic (branko) - 21 months ago 2024-02-24 00:55:17
branko@majic.rs
GC-43: Fix provisioning script for Vagrant machine:

- Version patch number can be longer than one digit, make sure to
strip it correctly.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
provision.sh
Show inline comments
 
@@ -31,49 +31,49 @@ if [[ $hostname != "gimmecert-testing" ]]; then
 
    exit 1
 
fi
 

	
 
# Update apt caches.
 
apt-get update -qq
 

	
 
# Install development tools.
 
apt-get install -qq -y git virtualenv
 

	
 
# Install Python build dependencies.
 
apt-get install -qq -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libffi-dev
 

	
 
# Import public keys for validating Python releases.
 
sudo -i -u vagrant gpg -q --import /vagrant/provision/python_releases_signing_keys.pub
 

	
 
# Download and build additional Python versions.
 
python_versions=("3.8.18" "3.9.18" "3.10.13" "3.11.8")
 
work_directory="/home/vagrant/src"
 

	
 
echo "Setting-up work directory."
 
sudo -i -u vagrant mkdir -p "$work_directory"
 

	
 
for version in "${python_versions[@]}"; do
 
    # Set-up information about Python version.
 
    minor_version="${version%.[[:digit:]]}"
 
    minor_version="${version%.[[:digit:]]*}"
 
    interpreter="/usr/local/bin/python${minor_version}"
 
    source_archive_link="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
 
    source_archive="$work_directory/Python-${version}.tar.xz"
 
    source_signature_link="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz.asc"
 
    source_signature="${source_archive}.asc"
 
    source="$work_directory/Python-${version}"
 

	
 
    # Check if the Python version has already been installed or not.
 
    if [[ ! -e $interpreter ]]; then
 
        echo
 
        echo
 
        echo "Installing Python $version"
 
        echo "=========================="
 

	
 
        echo "Downloading..."
 
        sudo -i -u vagrant wget -q -c -O "$source_archive" "$source_archive_link"
 
        sudo -i -u vagrant wget -q -c -O "$source_signature" "$source_signature_link"
 

	
 
        echo "Verifying signature..."
 
        sudo -i -u vagrant gpg --quiet --trust-model always --verify "$source_signature" "$source_archive"
 

	
 
        echo "Removing stale source files..."
 
        rm -rf "$source"
 

	
0 comments (0 inline, 0 general)