Skip to content

Commit

Permalink
Merge pull request #891 from ucb-bar/unfuck-zsh-yet-again
Browse files Browse the repository at this point in the history
Use a ZSH-compatible version of BASH_SOURCE[0]
  • Loading branch information
alonamid authored Jun 12, 2021
2 parents 022e973 + e196540 commit ad1c3ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/build-toolchains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
set -e
set -o pipefail

DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
# If BASH_SOURCE is undefined, we may be running under zsh, in that case
# provide a zsh-compatible alternative
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
CHIPYARD_DIR="$(dirname "$DIR")"

usage() {
Expand Down
4 changes: 3 additions & 1 deletion scripts/init-submodules-no-riscv-tools-nolog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ if [ "$MINGIT" != "$(echo -e "$MINGIT\n$MYGIT" | sort -V | head -n1)" ]; then
false
fi

DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
# If BASH_SOURCE is undefined we may be running under zsh, in that case
# provide a zsh-compatible alternative
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
CHIPYARD_DIR="$(dirname "$DIR")"

cd "$CHIPYARD_DIR"
Expand Down

0 comments on commit ad1c3ff

Please sign in to comment.