Merge pull request #988 from tymcauley/macos-readlink
Fix readlink on macOS
This commit is contained in:
@@ -6,9 +6,16 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# On macOS, use GNU readlink from 'coreutils' package in Homebrew/MacPorts
|
||||||
|
if [ "$(uname -s)" = "Darwin" ] ; then
|
||||||
|
READLINK=greadlink
|
||||||
|
else
|
||||||
|
READLINK=readlink
|
||||||
|
fi
|
||||||
|
|
||||||
# If BASH_SOURCE is undefined, we may be running under zsh, in that case
|
# If BASH_SOURCE is undefined, we may be running under zsh, in that case
|
||||||
# provide a zsh-compatible alternative
|
# provide a zsh-compatible alternative
|
||||||
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
DIR="$(dirname "$($READLINK -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
||||||
CHIPYARD_DIR="$(dirname "$DIR")"
|
CHIPYARD_DIR="$(dirname "$DIR")"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
|||||||
@@ -17,9 +17,16 @@ if [ "$MINGIT" != "$(echo -e "$MINGIT\n$MYGIT" | sort -V | head -n1)" ]; then
|
|||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# On macOS, use GNU readlink from 'coreutils' package in Homebrew/MacPorts
|
||||||
|
if [ "$(uname -s)" = "Darwin" ] ; then
|
||||||
|
READLINK=greadlink
|
||||||
|
else
|
||||||
|
READLINK=readlink
|
||||||
|
fi
|
||||||
|
|
||||||
# If BASH_SOURCE is undefined we may be running under zsh, in that case
|
# If BASH_SOURCE is undefined we may be running under zsh, in that case
|
||||||
# provide a zsh-compatible alternative
|
# provide a zsh-compatible alternative
|
||||||
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
DIR="$(dirname "$($READLINK -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
|
||||||
CHIPYARD_DIR="$(dirname "$DIR")"
|
CHIPYARD_DIR="$(dirname "$DIR")"
|
||||||
|
|
||||||
cd "$CHIPYARD_DIR"
|
cd "$CHIPYARD_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user