Linuxbrew rc script - scanning paths
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
# Homebrew initialization
|
||||
# Can set BREW_HOME in advance
|
||||
|
||||
BREW_LOCATIONS=( \
|
||||
"$HOME/.local/share/linuxbrew" \
|
||||
"$HOME/.linuxbrew" \
|
||||
"/home/linuxbrew/.linuxbrew" \
|
||||
xlog "Homebrew initialization"
|
||||
|
||||
BREW_LOCATIONS=(
|
||||
"$HOME/.local/share/linuxbrew"
|
||||
"$HOME/.linuxbrew"
|
||||
"/home/linuxbrew/.linuxbrew"
|
||||
)
|
||||
|
||||
if [[ ! -d "$BREW_HOME" ]]; then
|
||||
if [[ -z "$BREW_HOME" ]]; then
|
||||
for brew_path in "${BREW_LOCATIONS[@]}"; do
|
||||
xlog "CHECK $brew_path"
|
||||
if [[ -d "$brew_path" ]]; then
|
||||
BREW_HOME="$brew_path"
|
||||
xlog "FOUND $BREW_HOME"
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -19,6 +23,7 @@ fi
|
||||
BREW="$BREW_HOME/bin/brew"
|
||||
|
||||
if [[ -e "$BREW" ]]; then
|
||||
xlog "Loading brew shell environment from $BREW_HOME"
|
||||
path_backup="$PATH"
|
||||
eval "$($BREW shellenv)"
|
||||
PATH="$path_backup"
|
||||
@@ -27,3 +32,5 @@ if [[ -e "$BREW" ]]; then
|
||||
append_path "$HOMEBREW_PREFIX/sbin"
|
||||
fi
|
||||
|
||||
unset BREW
|
||||
unset BREW_LOCATIONS
|
||||
|
||||
Reference in New Issue
Block a user