#!/bin/sh # --> get the dir of this script SOURCE="${BASH_SOURCE[0]}" # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it # relative to the path where the symlink file was located done # --> decide if print debug DEBUG=0 for arg in $* do if [ $arg == "--debug" ]; then DEBUG=1 set -x break fi done SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" # echo "SCRIPT_DIR=$SCRIPT_DIR" # --> set python3 env . $SCRIPT_DIR/../set_py3_env.sh > /dev/null 2>&1 # --> decide PY or PYC if [ -e "$HBS_INST_PATH/rr2/bin/insight/insight_cli.py" ]; then PY_ENTRY="$HBS_INST_PATH/rr2/bin/insight/insight_cli.py" else PY_ENTRY="$HBS_INST_PATH/rr2/bin/insight/insight_cli.pyc" fi # --> run py # echo "python3 $PY_ENTRY -share_lock $1 $DEBUG_STR" python3 $PY_ENTRY "$@" set +x exit 0