File: //bin/flint
#!/bin/bash
bin_dir=`cd ${0%*/*};pwd`
tool_name=flint
int_suf=oem
not_default=1 # Temporary solution to handle flint_oem special case
if [ "$not_default" == "1" ]; then
int_tool_name="${tool_name}_${int_suf}"
else
int_tool_name="${tool_name}_int"
fi
ext_tool_name="${tool_name}_ext"
ext_exp_path="${bin_dir}/${ext_tool_name}"
int_exp_path="${bin_dir}/${int_tool_name}"
tool_path=""
function find_tool () {
tool=$1
exp_path=${bin_dir}/${tool}
if [ -f ${exp_path} ]; then
tool_path=${exp_path}
return 0
fi
tool_path=`which "${tool}" 2> /dev/null`
if [ "$tool_path" == "" ]; then
return 1
fi
return 0
}
for tool in ${int_tool_name} ${ext_tool_name}; do
find_tool ${tool}; RC=$?
if [ "${RC}" == "0" ]; then
break;
fi
done
if [ "${tool_path}" == "" ]; then
echo "-E- Neither ${int_tool_name} nor ${ext_tool_name} is installed on this machine"
exit 1
else
${tool_path} "$@"
exit $?
fi