tripleo-ci/scripts/set-os-type
Steven Hardy 118ee50747 Move tripleo.sh into tripleo-ci repo
We're discovering that everything needs backporting into both branches
despite the script handling both branches anyway.  Given that this
is designed only for developer and CI usage, we may as well save this
effort and move the script here instead.

When this is all working, we can remove the script from tripleo-common
and add a README instead pointing developers to the new location.

This is based on the content of tripleo-common at 6031198 - tripleo.sh
is unchanged except for adjusting the TENANT_PINGTEST_TEMPLATE path.

Change-Id: I9f3df108514a9d5f456e1c467993b778a2f91d89
2016-03-15 12:02:45 +00:00

53 lines
1.4 KiB
Bash
Executable File

#!/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