Fix dependency checking on osx

This commit is contained in:
Harshavardhana 2015-07-27 18:09:23 -07:00
parent 7133513600
commit c503bf412f

View File

@ -32,6 +32,27 @@ _init() {
MISSING=""
}
readlink() {
TARGET_FILE=$1
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(env readlink $TARGET_FILE)
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
done
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT
}
###
#
# Takes two arguments
@ -47,7 +68,7 @@ _init() {
# 3 - If args have length zero
#
####
check_version () {
check_version() {
## validate args
[[ -z "$1" ]] && return 3
[[ -z "$2" ]] && return 3
@ -106,7 +127,7 @@ check_golang_env() {
local new_go_binary_path=${go_binary_path}
if [ -h "${go_binary_path}" ]; then
new_go_binary_path=$(/bin/readlink -f ${go_binary_path})
new_go_binary_path=$(readlink ${go_binary_path})
fi
if [[ !"$(dirname ${new_go_binary_path})" =~ *"${GOROOT%%*(/)}"* ]] ; then