diskimage-builder/diskimage_builder/elements/yum/pre-install.d/01-00-centos-python3
Noam Angel e9b1997267 Move centos python3 installation after RHEL subscription
I088fc4284e889147ca9a375d4a159264cff53484 tried to slot the python3
install between the 00-dnf-update and before 01-package-installs;
however it also needs to run *after* the RHEL subscription
00-rhel-registration.

Thus a better place for it is 01-00-centos-python3, which will order
it after subscription and package updates, but before any use of
package-installs.

To avoid confusion over naming, move 00-0-dnf-update back to just
00-dnf-update.

Change-Id: Ib7c82895769e4889d47e10c4b37e06a42c053903
2020-09-07 11:22:55 +10:00

26 lines
871 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# Ensure the python3 interpreter and YAML libraries are installed
# early (even before package-installs, which is written in Python and
# uses YAML).
if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} == 7 ]]; then
# Our package map and install stuff doesn't have a way to say
# "install this from EPEL". So we hack in an install of it here
# from EPEL. Nothing else should have installed EPEL at this
# early stage.
yum install -y python3 epel-release
yum install -y python36-PyYAML
yum remove -y epel-release
elif [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} > 7 ]]; then
# For 8 and above ensure the "user" python3 package is installed
# so we have /usr/bin/python3 and pyyaml.
dnf install -y python3 python3-pyyaml
fi