Dirk Mueller 9aedc6f0a7 Fix openSUSE detection
TRIPLEO_OS_DISTRO needs to be opensuse for openSUSE.
Also, switch to the cross-distro standard way of
detecting distro flavor via /etc/os-release. The old
path is going to be removed soon.

Change-Id: I118ae7bb73f65e60d8313ab8d84eee379ae587eb
2014-01-25 12:28:52 +01:00

38 lines
987 B
Bash
Executable File

#!/bin/bash
TRIPLEO_OS_FAMILY='unsupported' # Generic OS Family: debian, redhat, suse
TRIPLEO_OS_DISTRO='unsupported' # Specific distro: centos, fedora, redhat, suse, ubuntu
if [ -f /etc/redhat-release ]; then
TRIPLEO_OS_FAMILY='redhat'
if $(grep -Eqs 'Red Hat Enterprise Linux' /etc/redhat-release); then
TRIPLEO_OS_DISTRO='rhel'
fi
if $(grep -Eqs 'CentOS' /etc/redhat-release); then
TRIPLEO_OS_DISTRO='centos'
fi
if $(grep -Eqs 'Fedora' /etc/redhat-release); then
TRIPLEO_OS_DISTRO='fedora'
fi
fi
if [ -f /etc/debian_version ]; then
TRIPLEO_OS_FAMILY='debian'
if $(grep -Eqs 'Ubuntu' /etc/lsb-release); then
TRIPLEO_OS_DISTRO='ubuntu'
fi
if $(grep -Eqs 'Debian' /etc/os-release); then
TRIPLEO_OS_DISTRO='debian'
fi
fi
if [ -f /etc/os-release ]; then
if $(egrep -qx "ID=opensuse" /etc/os-release); then
TRIPLEO_OS_FAMILY='suse'
TRIPLEO_OS_DISTRO='opensuse'
fi
fi
export TRIPLEO_OS_FAMILY
export TRIPLEO_OS_DISTRO