2015-12-10 19:38:53 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2024-07-04 14:24:53 +12:00
|
|
|
if [[ ${DISTRO_NAME} =~ (centos|rhel) ]]; then
|
|
|
|
# RHEL8 onwards has a system python, separate from the user python. What
|
2019-03-17 11:54:38 +02:00
|
|
|
# a good idea, abstracting the python binary for system scripts!
|
|
|
|
# :) Use it for dib-python.
|
|
|
|
python_path=/usr/libexec/platform-python
|
2020-02-05 11:42:52 +01:00
|
|
|
elif [[ ${DISTRO_NAME} =~ (debian) && ${DIB_PYTHON_VERSION} == 3 ]]; then
|
|
|
|
apt-get install -y python3
|
|
|
|
python_path=$(command -v python${DIB_PYTHON_VERSION})
|
2019-03-17 11:54:38 +02:00
|
|
|
else
|
|
|
|
python_path=$(command -v python${DIB_PYTHON_VERSION})
|
|
|
|
fi
|
|
|
|
|
2015-12-10 19:38:53 +00:00
|
|
|
if [ -z "$python_path" ]; then
|
2016-12-07 12:26:43 -08:00
|
|
|
echo "Could not find python${DIB_PYTHON_VERSION} executable."
|
2015-12-10 19:38:53 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-01-21 13:25:33 -06:00
|
|
|
ln -sf $python_path /usr/local/bin/dib-python
|