Add support for readlink on macOS

This commit is contained in:
2016-12-01 12:23:23 +01:00
parent a369451efb
commit d79e652c19

View File

@@ -2,7 +2,15 @@
set -e
ATTRACT_DIR="$(dirname "$(readlink -f "$0")")"
# macOS does not support readlink -f, so we use greadlink instead
if [[ `uname` == 'Darwin' ]]; then
ash greadlink 2>/dev/null || { echo >&2 "Install greadlink using brew."; exit 1; }
readlink='grealink'
else
readlink='readlink'
fi
ATTRACT_DIR="$(dirname "$($readlink -f "$0")")"
if [ ! -d "$ATTRACT_DIR" ]; then
echo "Unable to find Attract dir '$ATTRACT_DIR'"
exit 1