From 882690fcce6674ab92e7593938d7c2da0a0fd2f6 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 8 May 2014 01:30:51 +0000 Subject: [PATCH] Add distro check functions for Ubuntu and Fedora Add is_fedora & is_ubuntu functions, based on names of the checks used in devstack itself. Change-Id: I60763d5655344dd008f307b1caad8776277afb3b --- functions.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/functions.sh b/functions.sh index 3999ce39..67c2c80a 100644 --- a/functions.sh +++ b/functions.sh @@ -16,6 +16,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Distro check functions +function is_fedora { + lsb_release -i 2>/dev/null | grep -iq "fedora" +} + +function is_ubuntu { + lsb_release -i 2>/dev/null | grep -iq "ubuntu" +} + + function function_exists { type $1 2>/dev/null | grep -q 'is a function' }