#!/bin/bash TRIPLEO_OS_FAMILY='unsupported' # Generic OS Family: debian, redhat, suse TRIPLEO_OS_DISTRO='unsupported' # Specific distro: centos, fedora, rhel, # opensuse, sles, 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 'Derived from Red Hat Enterprise Linux' /etc/redhat-release); then TRIPLEO_OS_DISTRO='centos' 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 function get_os_release { ( source /etc/os-release echo $ID ) } if [ -f /etc/os-release ]; then if [ "$(get_os_release)" = "opensuse" ]; then TRIPLEO_OS_FAMILY='suse' TRIPLEO_OS_DISTRO='opensuse' fi if [ "$(get_os_release)" = "sles" ]; then TRIPLEO_OS_FAMILY='suse' TRIPLEO_OS_DISTRO='sles' fi fi export TRIPLEO_OS_FAMILY export TRIPLEO_OS_DISTRO