]> xenbits.xensource.com Git - people/dariof/xen-tools.git/commitdiff
Factor out functions to test if we should use yum or apt
authorAxel Beckert <abe@deuxchevaux.org>
Wed, 23 Jan 2013 16:40:00 +0000 (17:40 +0100)
committerAxel Beckert <abe@deuxchevaux.org>
Wed, 23 Jan 2013 16:40:00 +0000 (17:40 +0100)
hooks/common.sh

index b7ba661b03bdba23f428cab89fe929ce134e10c3..e176eed5548be9fa72424887967fee25501ffa9b 100755 (executable)
@@ -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