From 6dde6248edb7f43e3f8ee069947b88bfab622498 Mon Sep 17 00:00:00 2001 From: Montoya Edu Date: Fri, 25 Sep 2015 11:58:01 +0200 Subject: [PATCH] Fix setup readlink resolution --- setup.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 10a365b1..714c6e3f 100755 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,34 @@ # Customize this file by setting variables to suit your environment SOURCE="${BASH_SOURCE[0]}" SOURCE_DIR=`dirname $SOURCE` -export QUICKFAST_ROOT=`readlink -f $SOURCE_DIR` +$READLINK --version >/dev/null 2>/dev/null +if (( $? != 0 )); then + echo "readlink does not exist or it does not support --version" + echo "maybe it is not GNU readlink but BSD" + echo "trying with greadlink..." + READLINK='greadlink' +fi +$READLINK --version >/dev/null 2>/dev/null +if (( $? != 0 )); then + echo "greadlink does not exist or an error occurred" + UNAME=`uname` + if [[ $UNAME == "Darwin" ]]; then + echo "You are running on a Mac OSX system." + echo "Consider installing homebrew." + echo "Then install coreutils." + echo "# brew install coreutils" + fi +else + echo "$READLINK found at `which $READLINK`." +fi +$READLINK -f $SOURCE_DIR +if (( $? != 0 )); then + echo "trying exporting QUICKFAST_ROOT by pwd." + export QUICKFAST_ROOT=`pwd` + echo "QUICKFAST_ROOT = $QUICKFAST_ROOT" +else + export QUICKFAST_ROOT=`$READLINK -f $SOURCE_DIR` +fi if test "$MPC_ROOT" = "" then