From 3c72799ceb7d093cdd82684037a9d7306fec4b3f Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Mon, 18 Dec 2017 22:36:35 +0100 Subject: [PATCH] Fix script path detection --- gbm.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gbm.sh b/gbm.sh index 1e9e8e4..5794da7 100755 --- a/gbm.sh +++ b/gbm.sh @@ -6,17 +6,17 @@ done for lib in libsqlite3;do [ -n "`ldconfig -p | grep ${lib}`" ] || (echo "Please install ${lib}" && exit 1); done -DIR="$( cd "$( dirname "$(pwd)/$0" )" && pwd )"; -echo "Located in ${DIR}"; -GBMPATH='./'; +dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" +echo "Located in ${dir}"; +gbmpath='./'; #locate GBM.exe -if [ "${DIR}" = '/bin' ] && [ -s '/usr/share/gbm/GBM.exe' ]; then - GBMPATH='/usr/share/gbm/'; -elif [ "${DIR}" = '/usr/local/bin' ] && [ -s '/usr/local/share/gbm/GBM.exe' ]; then - GBMPATH='/usr/local/share/gbm/'; +if [ "${dir}" = '/bin' ] && [ -s '/usr/share/gbm/GBM.exe' ]; then + gbmpath='/usr/share/gbm/'; +elif [ "${dir}" = '/usr/local/bin' ] && [ -s '/usr/local/share/gbm/GBM.exe' ]; then + gbmpath='/usr/local/share/gbm/'; elif [ ! -s './GBM.exe' ]; then echo 'GBM.exe not found'; exit 2; fi -mono --desktop ${GBMPATH}'GBM.exe' "$@"; +mono --desktop ${gbmpath}'GBM.exe' "$@"; exit $?;