#!/bin/bash
# .: py_src_run.sh (run.sh) :.
# Main backend invokation script
# Author: Timothy C. Quinn
# Home: https://github.com/JavaScriptDude/py_src_run
# .: Installation :.
#% mkdir ~/.py_src_run
#% _C=py_src_run _D=~/.${_C} && cp ./${_C}.sh $_D/run.sh && chmod a+x $_D/run.sh
PYINITERR=""
if [ "$#" -lt "2" ]; then
PYINITERR="Invalid args. Expecting [, ...]"
fi
# Parse Module Src Path
if [[ $PYINITERR == "" ]]; then
MSPATH="$1"
if [ ! -d "$MSPATH" ]; then
PYINITERR="Module path provided to py_run_as_root does not exist: ${MSPATH}"
fi
fi
# Parse Module
if [[ $PYINITERR == "" ]]; then
MOD="$2"
if [ ! -d "$MSPATH/$MOD" ]; then
PYINITERR="Module provided to py_run_as_root does not exist: $MSPATH/$MOD"
fi
fi
# Get HOME and pyinit.sh location
if [[ $PYINITERR == "" ]]; then
SCRP="$0"
SCR_FILE=`basename $SCRP`
PYRUNDIR=`dirname $SCRP`
readarray -d / -t a