#! /bin/bash

#
# Collective Knowledge (CK)
#
# See CK LICENSE.txt for licensing details.
# See CK COPYRIGHT.txt for copyright details.
#
# Developer: Grigori Fursin
#

# CK entry point

# Check if CK_ROOT is defined and used it, otherwise use auto-detected path
if [ -z "$CK_ROOT" ]; then 
  if [ -d "/var/ck/ck" ]; then
    CK_path="/var/ck"
  else
    CK_path1=`dirname $0`
    pushd $CK_path1/.. > /dev/null
    CK_path=`pwd`
    popd > /dev/null
  fi
  export CK_ROOT=$CK_path; 
fi

# Load kernel module (either GIT/local installation or as package)
if [ -f "$CK_ROOT/ck/kernel.py" ]; then 
 python -W ignore::DeprecationWarning $CK_ROOT/ck/kernel.py "$@"
else
 python -m ck.kernel "$@"
fi
