Linuxbrew rc script - scanning paths

This commit is contained in:
Martin Blazik
2022-10-16 19:03:35 +02:00
parent 54d6072a42
commit ee6ebdc945

View File

@@ -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