function check_pkg_presence
{
  _LOCAL_PACKAGE_BASE=$1
  _PKG_DIR=$2
  _PKG=$3
  _PACKAGE_RELEASE=$4
  _TYPE=$5

  if [ ! -e $_LOCAL_PACKAGE_BASE/$_PKG_DIR/$_PKG ]; then
    echo "Could not find $_LOCAL_PACKAGE_BASE/$_PKG_DIR/$_PKG"
    mkdir -p $_LOCAL_PACKAGE_BASE/$_PKG_DIR
    echo "Fetching $_PKG"
    echo wget --quiet http://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-$_PACKAGE_RELEASE/$_TYPE/$_PKG_DIR/$_PKG -O $_LOCAL_PACKAGE_BASE/$_PKG_DIR/$_PKG
    wget --quiet http://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-$_PACKAGE_RELEASE/$_TYPE/$_PKG_DIR/$_PKG -O $_LOCAL_PACKAGE_BASE/$_PKG_DIR/$_PKG
  else
    echo "Using $_LOCAL_PACKAGE_BASE/$_PKG_DIR/$_PKG"
  fi
}


