From 15bed27caaa8e37bdaf36c8aedc3cb450e1379db Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 18 Sep 2015 13:51:19 +1000 Subject: [PATCH] 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 --- functions.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index 096b6991..7f57b584 100644 --- a/functions.sh +++ b/functions.sh @@ -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 {