From d97d1af1eeb4185e9ae6ce73c3184e5e9834902b Mon Sep 17 00:00:00 2001 From: Dimitrios Apostolou Date: Wed, 2 Oct 2019 19:04:25 +0200 Subject: Fix provisioning script for RHEL 6 It seems RHEL 6.6 does not provide /etc/os-release. Change-Id: I01ba2bb17b89c01f9991944a11eeaa9c2eba6f20 Reviewed-by: Heikki Halmet --- coin/provisioning/common/unix/common.sourced.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'coin') diff --git a/coin/provisioning/common/unix/common.sourced.sh b/coin/provisioning/common/unix/common.sourced.sh index a52880b2..7fb267a6 100644 --- a/coin/provisioning/common/unix/common.sourced.sh +++ b/coin/provisioning/common/unix/common.sourced.sh @@ -74,6 +74,25 @@ is_script_executed common.sourced.sh \ && fatal "Script common.sourced.sh should always be sourced, not executed" +_detect_linux_OS_ID () { + if [ -f /etc/os-release ] + then + . /etc/os-release + PROVISIONING_OS_ID="$ID" + elif [ -f /etc/redhat-release ] + then + case "$(cat /etc/redhat-release)" in + "Red Hat Enterprise Linux"*) + PROVISIONING_OS_ID="rhel" + ;; + "CentOS Linux"*) + PROVISIONING_OS_ID="centos" + ;; + *) fatal "Unknown string in /etc/redhat-release" ;; + esac + fi +} + set_common_environment () { # Unfortunately we can't find the provisioning directory from a sourced # script in a portable way @@ -86,8 +105,7 @@ set_common_environment () { case "$uname_s" in Linux) PROVISIONING_OS=linux - . /etc/os-release - PROVISIONING_OS_ID="$ID" + _detect_linux_OS_ID case "$PROVISIONING_OS_ID" in suse|sles|opensuse*) CMD_PKG_INSTALL="sudo zypper -nq install" -- cgit v1.2.3