diskimage-builder/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python
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

27 lines
767 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} > 7 ]]; then
# RHEL8 has a system python, separate from the user python. What
# a good idea, abstracting the python binary for system scripts!
# :) Use it for dib-python.
python_path=/usr/libexec/platform-python
elif [[ ${DISTRO_NAME} =~ (debian) && ${DIB_PYTHON_VERSION} == 3 ]]; then
apt-get install -y python3
python_path=$(command -v python${DIB_PYTHON_VERSION})
else
python_path=$(command -v python${DIB_PYTHON_VERSION})
fi
if [ -z "$python_path" ]; then
echo "Could not find python${DIB_PYTHON_VERSION} executable."
exit 1
fi
ln -sf $python_path /usr/local/bin/dib-python