Generic RPM installation detection

This is an alternative to I77957e9a107f0b1aeef81fb6a98e9840954d2a44
which makes detection of RPM-based distros a little more generic.

After some thought, this seems to be a pretty low-level and generic
way to match what we want right now; i.e. centos, fedora & related
rhel-based distros like cloudos).

The will all have a /etc/*-release file managed by RPM, and all
non-relevant systems (debian/ubuntu) will not (even if they somehow
managed to get rpm installed, for alien or something).

Change-Id: If2bd38df2a9720aa9288aa522b7587136e900d93
This commit is contained in:
Ian Wienand
2015-09-18 13:51:19 +10:00
parent c5d468ac84
commit 15bed27caa

View File

@@ -20,9 +20,15 @@ SUDO="sudo"
# Distro check functions
function is_fedora {
# note we consider CentOS 7 as fedora for now
lsb_release -i 2>/dev/null | grep -iq "fedora" || \
lsb_release -i 2>/dev/null | grep -iq "CentOS"
# note this is a little mis-named, we consider basically anything
# using RPM as "is_fedora". This includes centos7, fedora &
# related distros like CloudOS and OracleLinux (note, we don't
# support centos6 with this script -- we are assuming is_fedora
# implies >=centos7 features such as systemd/journal, etc).
#
# This is KISS; if we need more fine-grained differentiation we
# will handle it later.
rpm -qf /etc/*-release >&/dev/null
}
function is_ubuntu {