Permalink
Find file
executable file 26 lines (19 sloc) 656 Bytes
#!/bin/bash
set +o posix
chdir() {
cd "$@" >/dev/null
}
BREW_FILE_DIRECTORY="$(chdir "${0%/*}" && pwd -P)"
HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}"
HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}"
HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX"
if [[ -L "$HOMEBREW_BREW_FILE" ]]
then
BREW_SYMLINK="$(readlink "$HOMEBREW_BREW_FILE")"
BREW_SYMLINK_DIRECTORY="$(dirname "$BREW_SYMLINK")"
BREW_FILE_DIRECTORY="$(chdir "$BREW_FILE_DIRECTORY" &&
chdir "$BREW_SYMLINK_DIRECTORY" && pwd -P)"
HOMEBREW_REPOSITORY="${BREW_FILE_DIRECTORY%/*}"
fi
HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
source "$HOMEBREW_LIBRARY/brew.sh"