diskimage-builder/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version
Carlos Goncalves 367dfc9294 Add support for CentOS 8 Stream
This patch adds support for CentOS 8 Stream [1] to the centos-minimal
element. Users should set DIB_RELEASE=8-stream.

[1] https://www.centos.org/stream/

Change-Id: Id0825de735ab957c10daf35fb3c641f850cc6847
2020-06-22 10:36:30 +02:00

41 lines
1.2 KiB
Plaintext

# Pick which distros we need to force python2 and which to python3
if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
if [ "$DISTRO_NAME" == "ubuntu" ]; then
if [ "$DIB_RELEASE" == "trusty" ]; then
DIB_PYTHON_VERSION=2
fi
elif [ "$DISTRO_NAME" == "debian" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "fedora" ]; then
if [ "$DIB_RELEASE" -le 22 ]; then
DIB_PYTHON_VERSION=2
fi
elif [ "$DISTRO_NAME" == "centos7" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "rhel7" ]; then
# TODO(nmagnezi): Remove this when the 'rhel7' element gets replaced by 'rhel'
DIB_PYTHON_VERSION=2
elif [[ "$DISTRO_NAME" =~ (rhel|centos) ]]; then
if [[ "${DIB_RELEASE}" == "7" ]]; then
DIB_PYTHON_VERSION=2
else
DIB_PYTHON_VERSION=3
fi
elif [ "$DISTRO_NAME" == "opensuse" ]; then
if [ "${DIB_RELEASE:0:2}" == "42" ]; then
DIB_PYTHON_VERSION=2
fi
fi
fi
if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
DIB_PYTHON_VERSION=3
fi
export DIB_PYTHON_VERSION
export DIB_PYTHON=python${DIB_PYTHON_VERSION}
# Local variables:
# mode: sh
# End: