From 0c8b5d25c419bb85f99d223aa13f4ae4440c76bd Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Wed, 23 Jan 2013 17:40:00 +0100 Subject: [PATCH] Factor out functions to test if we should use yum or apt --- hooks/common.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hooks/common.sh b/hooks/common.sh index b7ba661..e176eed 100755 --- a/hooks/common.sh +++ b/hooks/common.sh @@ -224,6 +224,13 @@ installRPMPackage () installCentOS4Package () { installRPMPackage "$@" } +# +# Functions to test if we're on a redhatesk or debianesk system +# +isAPT() ( [ -x $1/usr/bin/apt-get ] ) +isYum() ( [ -x $1/usr/bin/yum ] ) + + # # Install a package using whatever package management tool is available # @@ -232,10 +239,10 @@ installPackage () prefix=$1 package=$2 - if [ -x ${prefix}/usr/bin/apt-get ] ; then + if isAPT ; then installDebianPackage "$@" - elif [ -x ${prefix}/usr/bin/yum ] ; then + elif isYum ; then installRPMPackage "$@" else -- 2.39.5