diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 638e9dc19c..bec742ffa0 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -1,3 +1,24 @@ +# Force UTF-8 to avoid encoding issues for users with broken locale settings. +if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] +then + export LC_ALL="en_US.UTF-8" +fi + +# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local +# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY. +if [[ -d "$HOMEBREW_REPOSITORY/Cellar" ]] +then + HOMEBREW_CELLAR="$HOMEBREW_REPOSITORY/Cellar" +else + HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar" +fi + +case "$*" in + --prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;; + --cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;; + --repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;; +esac + HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbrev=7 2>/dev/null)" HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION" if [[ -z "$HOMEBREW_VERSION" ]] @@ -42,27 +63,6 @@ git() { "$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" "$@" } -# Force UTF-8 to avoid encoding issues for users with broken locale settings. -if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] -then - export LC_ALL="en_US.UTF-8" -fi - -# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local -# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY. -if [[ -d "$HOMEBREW_REPOSITORY/Cellar" ]] -then - HOMEBREW_CELLAR="$HOMEBREW_REPOSITORY/Cellar" -else - HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar" -fi - -case "$*" in - --prefix) echo "$HOMEBREW_PREFIX"; exit 0 ;; - --cellar) echo "$HOMEBREW_CELLAR"; exit 0 ;; - --repository|--repo) echo "$HOMEBREW_REPOSITORY"; exit 0 ;; -esac - if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]] then # it may work, but I only see pain this route and don't want to support it