From 6d13061d653ffe84de00a904c6b49f4caaee2e30 Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Fri, 27 Mar 2020 15:14:36 -0700 Subject: [PATCH] Support CentOS 8 builds Changes needed to run the packer against CentOS 8 systems Issue: RELENG-2823 Change-Id: I7748d98150630bc5327d407eab5421a2ec21e7bf Signed-off-by: Andrew Grimberg --- provision/install-base-pkgs-RedHat.yaml | 13 ++++++++++++- provision/install-python.sh | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/provision/install-base-pkgs-RedHat.yaml b/provision/install-base-pkgs-RedHat.yaml index 7e3dd34..898b4e6 100644 --- a/provision/install-base-pkgs-RedHat.yaml +++ b/provision/install-base-pkgs-RedHat.yaml @@ -12,6 +12,15 @@ - git2u* - yum-plugin-replace become: true + when: + - ansible_distribution_major_version < 8 + +- name: Enable PowerTools + command: + cmd: dnf config-manager --set-enabled PowerTools + warn: no + become: true + when: ansible_distribution_major_version >= 8 - name: Install base packages yum: @@ -19,7 +28,7 @@ - "@base" - "@development" - yum-utils - - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + - https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm state: latest become: true @@ -37,3 +46,5 @@ command: yum replace -y git --replace-with git2u when: ansible_facts.packages['git'] is defined become: true + when: + - ansible_distribution_major_version < 8 diff --git a/provision/install-python.sh b/provision/install-python.sh index 44056c3..7ede4ec 100755 --- a/provision/install-python.sh +++ b/provision/install-python.sh @@ -28,6 +28,17 @@ function is_ubuntu() return 1 } +function is_centos8() +{ + # if the file exists and contains a centos:8 CPE_NAME, return 0 + if grep -Eq "^CPE_NAME=.*centos:8" /etc/os-release 2> /dev/null; then + echo "Distro is CentOS 8" + return 0 + fi + echo "Distro is NOT CentOS 8" + return 1 +} + if is_ubuntu; then # Use netselect to choose a package mirror to install python-minimal in a # reliable manner. @@ -67,5 +78,11 @@ if is_ubuntu; then apt install -y python-minimal fi -type python +if is_centos8; then + echo "Install python36" + dnf clean all + dnf install -y python36 +fi + +type python || type python3 type sudo -- 2.16.6