summaryrefslogtreecommitdiffstats
path: root/xci
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2017-10-02 13:03:48 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-10-02 13:03:48 +0000
commit801ad937b0e2a65f06765f9e279ce3a6f20452e0 (patch)
tree66677f39f7fbee3d71c7becc15f9955a7b7879cf /xci
parent0fe2124a02eac70a586c5dc1fea693345be59585 (diff)
parent2cb04a2e384e3e25d852616cb9e8f3b355f6fb2d (diff)
Merge "xci: install-ansible.sh: Fix distribution detection"
Diffstat (limited to 'xci')
-rw-r--r--xci/file/install-ansible.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/xci/file/install-ansible.sh b/xci/file/install-ansible.sh
index 85d02d09..ca7763ad 100644
--- a/xci/file/install-ansible.sh
+++ b/xci/file/install-ansible.sh
@@ -14,9 +14,10 @@ CHECK_CMD_PKGS=(
python-devel
)
-# Check zypper before apt-get in case zypper-aptitude
-# is installed
-if [ -x '/usr/bin/zypper' ]; then
+source /etc/os-release || source /usr/lib/os-release
+
+case ${ID,,} in
+ *suse)
OS_FAMILY="Suse"
INSTALLER_CMD="sudo -H -E zypper install -y"
CHECK_CMD="zypper search --match-exact --installed"
@@ -39,7 +40,9 @@ if [ -x '/usr/bin/zypper' ]; then
if $(${CHECK_CMD} patterns-openSUSE-minimal_base-conflicts &> /dev/null); then
sudo -H zypper remove -y patterns-openSUSE-minimal_base-conflicts
fi
-elif [ -x '/usr/bin/apt-get' ]; then
+ ;;
+
+ ubuntu|debian)
OS_FAMILY="Debian"
INSTALLER_CMD="sudo -H -E apt-get -y install"
CHECK_CMD="dpkg -l"
@@ -56,7 +59,9 @@ elif [ -x '/usr/bin/apt-get' ]; then
)
EXTRA_PKG_DEPS=()
sudo apt-get update
-elif [ -x '/usr/bin/dnf' ] || [ -x '/usr/bin/yum' ]; then
+ ;;
+
+ rhel|centos|fedora)
OS_FAMILY="RedHat"
PKG_MANAGER=$(which dnf || which yum)
INSTALLER_CMD="sudo -H -E ${PKG_MANAGER} -y install"
@@ -75,9 +80,10 @@ elif [ -x '/usr/bin/dnf' ] || [ -x '/usr/bin/yum' ]; then
)
sudo yum update --assumeno
EXTRA_PKG_DEPS=()
-else
- echo "ERROR: Supported package manager not found. Supported: apt,yum,zypper"
-fi
+ ;;
+
+ *) echo "ERROR: Supported package manager not found. Supported: apt,yum,zypper"; exit 1;;
+esac
if ! $(python --version &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[python]}