From 87db65f22df9c8a0223874473e6a237edb3d1205 Mon Sep 17 00:00:00 2001 From: saadrahim <44449863+saadrahim@users.noreply.github.com> Date: Fri, 5 Jun 2020 11:04:03 -0600 Subject: [PATCH] Fixing CI as install.sh script should not install dependencies without user request (#217) --- install.sh | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 15899e7fbb..76db967ef9 100755 --- a/install.sh +++ b/install.sh @@ -28,7 +28,7 @@ run_tests=false build_release=true install_library=false build_hip_clang=true - +install_dependencies=false # ################################################# # Parameter parsing # ################################################# @@ -58,6 +58,9 @@ while true; do -i|--install) install_library=true shift ;; + -d|--dependencies) + install_dependencies=true + shift;; -p|--package_build) build_package=true shift ;; @@ -85,6 +88,17 @@ while true; do rocm_path=/opt/rocm/bin +# /etc/*-release files describe the system +if [[ -e "/etc/os-release" ]]; then + source /etc/os-release +elif [[ -e "/etc/centos-release" ]]; then + OS_ID=$(cat /etc/centos-release | awk '{print tolower($1)}') + VERSION_ID=$(cat /etc/centos-release | grep -oP '(?<=release )[^ ]*' | cut -d "." -f1) +else + echo "This script depends on the /etc/*-release files" + exit 2 +fi + # throw error code after running a command in the install script check_exit_code( ) { @@ -126,11 +140,18 @@ if [[ "${build_hip_clang}" == false ]]; then fi cmake_executable=cmake -if [[ -e /etc/redhat-release ]]; then - yum install chrpath libgomp - cmake_executable=cmake3 -else - apt install chrpath libomp-dev +case "${OS_ID}" in + centos|rhel) + cmake_executable=cmake3 + ;; + esac + +if ($install_dependencies); then + if [[ -e /etc/redhat-release ]]; then + yum install chrpath libgomp + else + apt install chrpath libomp-dev + fi fi check_exit_code "$?"